To unlock your iPhone from its carrier, you'll likely need to contact your carrier directly to cancel your contract.
If you want to switch carrier networks on your Google Pixel, you might have to unlock the phone. Here's how to unlock any Google Pixel phone.