Locking phones to a network is something mobile phone operators do just to make your life more difficult, but it's simply a financial decision. When you get a new phone from a network, they're subsidising the cost of the handset, and they don't want you to use that phone on another network and give your money to another company instead of them.
As of December 2021, mobile providers are banned from locking devices to their networks. So if you purchased your phone after that date, it will be unlocked. However, if you have an older device that you purchased before this date, it could be network-locked.
The easiest way to determine whether your phone is locked or unlocked is to check your Settings. On iPhone simply go to Settings > General > About > Network Provider Lock. On Android navigate to Settings > About Phone > Status Information > SIM Card Status > Mobile Network State.
For older phone models try using a SIM card from another network. If you have a friend or family member on a different network, you could borrow their SIM card briefly to check. A mobile phone that is network-locked will allow you to make emergency calls only when you try to use a SIM card from another network. If it is unlocked, then your call will go through successfully. This straightforward method should give you a clear answer without any hassle.
When selling your phone, mobile phone recycling companies usually pay more for an unlocked handset than one locked to a specific network. This is because network-locked handsets are less appealing for consumers on the refurbished market and using commercial unlocking service comes at a cost for recyclers. So unlocking your device will help you get the best price, as recyclers don’t need to worry or pay extra to unlock it. For consumers it is free to unlock their devices via their network providers, and you will gain anywhere from £5 by selling an unlocked handset (how much more exactly will vary depending on your network and phone model).
It's important to know the difference between unlocking and unblocking your phone. Unlocking your phone means removing the restriction that locks it to a network, allowing you to use a SIM card from other networks, which is completely legal. If a phone is blocked rather than locked, it has been disabled, usually because it was reported lost or stolen. Attempting to unblock a phone is illegal, but unless you are in possession of a stolen phone, you shouldn't need to do this anyway!
In short, yes. However, you may get more for your device if it is unlocked, and if you’re selling privately, a network-locked device may be less attractive to potential buyers.
Since October 2016, networks must unlock your phone for free once your contract has finished. Most networks will still unlock the device free of charge, even if you’re still within your minimum contract. Nowadays, you can request that your phone be unlocked online. Simply head over to your network provider’s website. You could go to a local phone shop to get your device unlocked, but this will likely cost money.