Everyone could unlock the iPhone before use on a new carrier if it is currently the new payment plan on a different carrier. If the iPhone is locked it will not be able to connect to the network and other connections. So it will be a problem if you plan to switch to the other carriers and to connect to the other networks. So follow the guidelines to unlock the iPhone.
Request for unlocking from the carrier
Make sure the iPhone is fully paid. Everyone needs their carrier support to unlock the iPhone, and it will refuse to unlock the phone if it is still on the payment plan.
Make a call on requesting for unlocking with the carrier. If you have AT&T, then you can avoid calling for the customer service. This may take a few hours to process.
Cancel the old contract
Proceed with the sim card
The best advice is to back up your data on the iCloud and safely remove your sim card from the sim card slot.
Kindly insert the paperclip inside the sim card slot after removing the sim card from the phone.
Follow up to set up your phone
Proceed without the sim card
Back up the data in the iCloud and the iTunes
Erase all the data by restoring the phone by original restore factory settings