There are quite a few differences between a Masters in TESOL and a level 5 TEFL certificate. For one, you could be studying for a Masters in TESOL for up to 2 years, whereas a level 5 TEFL certificate can be completed in 168 hours.
A Masters in TESOL therefore goes much more in depth than a TEFL certificate does. It has a heavier focus on theory and can cover topics such as language acquisition, the history of the English language, and the relationship between language and culture. You'll also be expected to conduct your own research during the course.
A level 5 TEFL certificate, on the other hand, is focused on providing you with the skills you need to teach English online or abroad. You'll cover topics like classroom management, lesson planning, and grammar. Plus, you'll learn how to teach reading, writing, listening, and speaking. You can get a good overview of the level 5 TEFL course here.
If you want to get out there and start teaching English as quickly as possible, obtaining a level 5 TEFL certificate will be the best option of the two you have mentioned.
If you’re interested in theoretical-based learning, and want to go into greater detail, it could be worth exploring a Masters in TESOL.
It's worth mentioning that there are also other TEFL levels you could choose from, such as TEFL level 3 and TEFL level 7. A TEFL level 7 course is of an equivalent level to a TESOL Masters. An example of this is the DELTA qualification. However, this is usually done over the course of 7 to 12 weeks rather than the 1 or 2 years that it takes to do a Masters.
I hope that helps. If you want to explore options in different countries or online, you can check out this directory of TEFL courses.