Making sure an iPhone is unlocked when buying or selling a used device can make or break the sale. It's important that the iPhone is unlocked, so that any compatible SIM card can be used. When an iPhone is locked to one cellular carrier, it cannot be used on another network. Once a device is out-of-contract carriers must unlock it when requested to do so. Many iPhones are sold unlocked, and thanks to iOS 14 there's an easy way to verify if a device is unlocked.
Since the major U.S. carriers came into full compliance with the CTIA's Consumer Code for Wireless Service on February 11, 2015, they can no longer refuse to unlock your device (assuming you are eligible). This means you can unlock your iPhone and go to a new carrier if you wish.
The big four carriers agreed to come into full compliance with the CTIA's Consumer Code for Wireless Service (section 12) by February 11, 2015, which they all did. This means they can no longer refuse to unlock your device so it can work on another carrier's network.
You cannot unlock your Verizon iPhone simply because Verizon does not lock its 4G LTE or 3G devices. You don't need to do anything to use your Verizon iPhone with another carrier. For more information, see Verizon's Device Unlocking Policy.
Thanks to the CTIA Consumer Code for Wireless Service (Section 12), AT&T, as of February 11, 2015, is required to unlock your iPhone if you are eligible and wish to do so. Once your phone is unlocked, you can switch to a different carrier.