If you get an unlocked (no carrier agreement) phone it will work on any service unless there are other technical issues.
Here are other considerations:
Make sure it will work in your country! --> 5G and LTE. Find the iPhone that’s right for your country or region. - https://www.apple.com/iphone/cellular/
and https://en.wikipedia.org/wiki/List_of_LTE_networks
Also check if your intended carrier requires a CDMA or GSM phone.
Some carriers 9chck with your home country) will not accept unlocked phones - https://discussions.apple.com/message/20359060#20359060 - E.g., "Virgin Mobile, like all CDMA carriers, will only activate devices on their network that were initially sold for use on their network." and https://discussions.apple.com/message/33206605#message33206605 "The iPhone 7 and 7 Plus sold unlocked and for use on AT&T and T-Mobile is not physically compatible with the Verizon and Sprint networks."
If you can‘t make a FaceTime call on your iPhone, iPad, or iPod touch - https://support.apple.com/HT204168
November 2020 version "FaceTime isn't available or might not appear on [new] devices purchased in [...,] Pakistan, and United Arab Emirates, including Dubai."
Discounted phones sold in some US locations may be locked to a carrier. You have to complete the contract with the carrier before they will unlock the phone. In the end you are not saving money and may have to wait a long time. https://discussions.apple.com/thread/252444302?answerId=254609062022#254609062022
Warranty restriction! - http://www.apple.com/legal/warranty/products/ios-warranty-document-us.html - "IMPORTANT RESTRICTION FOR iPHONE, iPAD AND APPLE TV SERVICE. Apple may restrict warranty service for iPhone, iPad and Apple TV to the country where Apple or its Authorized Distributors originally sold the device." <-- The warranty does not outright deny warranty coverage in other countries but there are many limitations to the effect Apple almost certainly will refuse to do repairs under warranty or even repairs at all except in the country of purchase. The device would have to be sent to a friend in the country of purchase to handle any repair claims because Apple will not handle international shipping.
Devices may also have tax added to the cost (e.g., in the USA prices do not include taxes), and you may have to pay import duty when bringing an expensive device into your country.