If you're still using a 4G smartphone along with a T-Mobile SIM card, it may be time for you to upgrade to a 5G handset as T-Mobile is phasing out 4G.
To unlock your iPhone from its carrier, you'll likely need to contact your carrier directly to cancel your contract.
You can manually update the carrier settings on an iPhone through its Settings app to ensure your phone works properly.