The answers here are only partially correct. If you want to use your device internationally, there are four things or categories you need to consider:
- Carrier locked devices
- Region-specific devices
- Carrier whitelisting
- Regulatory requirements
Carrier locked devices are exactly that, these are the ones sold by your carrier and subsidised, they usually mention that you can't use them with other carriers. Eg the SM-S928U of the S24 works only on AT&T. If you have one of these, you may be able to buy an unlock code online to unlock your phone. Depending on your model, you might also need to flash compatible firmware or unlock additional bands from the service menu, if you want to be able to actually use it with your destination carrier.
Region-specific devices generally have limited cellular bands, meant for usage in that country. Eg although the SM-S928U1 variant of the S24 is factory unlocked (unlike the SM-S928U), it may not carry all the bands required for operation outside the US. If you're unsure about compatibility, use this website to check the bands for your target country/carrier. Generally though, if you travel a lot, it's recommend to buy the international / global variant of a phone. As an alternative, if you have a US variant Samsung, you could use the service menu to enable all bands. Though regardless of the variant, it's always a good idea to check the band compatibility before you purchase the device/travel.
Carrier whitelisting is a recent annoying thing which carriers have started doing for some technologies such as 5G, VoLTE, VoWiFi etc. Some of these features may or may not be critical for you, for eg, if the destination carrier no longer offer 2G/3G services, that means you must be able to get VoLTE in order to make calls. And VoWiFi is needed if you're in an area with poor reception, but have WiFi access. Finally, 5G would be a bonus thing but most carriers allow only whitelisted models to connect to their 5G services. Samsung normally should work in general, but given how many variants Samsung makes, there's no guarantee that your specific variant would be able to use some/all of these services. So you'll need to check with your target carrier in advance to see which of their services your phone would be able to support.
Finally, some countries may have regulatory requirements which may legally prevent shops/carriers from selling you a SIM card, if your phone isn't in their database. For instance, in Japan, it's technically illegal to operate a device without a "giteki" mark - and if your phone doesn't have this, operators may refuse to sell you a card. In this case however, you should be fine if you order a compatible SIM/eSIM online before arrival (eg from Sakura Mobile).