On my trip to Europe a few months ago, I used the combination method already mentioned, that works great if you have a newer phone that can use multiple SIM cards or eSIMs.
My phone carrier is Mint Mobile and they recently introduced a new international option: 30 days of 100 minutes talk and 100 text for $5. I don’t have much travel need for calling/texting (although various travel services/lodgings increasingly do use text messages so it’s super handy), but for $5 I jumped on that plan for one specific reason: To be able to receive MFA codes sent to my US phone number while my phone is with me in Europe.
At $5 that plan does not include international data, but data is what I am really going to use every day in other countries, so what about that? For that I bought and installed a data eSIM covering the amount of data I wanted over a three week trip. It was about $40 from Airalo but other companies can work just as well. Having traveled internationally for 35 years since the age of paper only, I have to say I was a little shocked by how much modern travel now relies on apps and QR codes, even simple things like train, bus, and museum tickets…if you don’t have a smartphone with a good mobile data plan, some things will take more time and hassle.
This worked because my recent phone can store up to 5 eSIMs. I did not have to change the eSIM for the normal everyday US phone number, I only had to add the eSIM for the Europe-only data plan. My phone can use both simultaneously, so if I am using the data eSIM to sign into a US website and it sends a code to my US phone number on file, I receive that through the voice/text eSIM and enter it on the website.
It worked great, with enough data that I never had to worry about finding wifi (such a pain on previous trips), and I would totally do it this way again.
Another approach that might work with some websites/apps: Get away from codes based on text messages or email, and use codes from an authenticator app instead. Although authenticator apps aren't perfect, they are more secure than notoriously insecure email or SMS text. If a website offers passkeys, that is even better and should be your first choice over all the others if available. Just make sure you know how to use them. (Yes, some will say the actual best way is a hardware key like a YubiKey and it probably is, but it's not an easy solution for many people, especially if you aren't comfortable with how to get into your accounts if the hardware key is lost or stolen.)
In other words, if SMS text codes are a hassle, try not to fall back to equally insecure email. Try to upgrade to a more secure second factor like an authenticator app, passkey, or hardware key.