You can unlock your Android phone even if you've forgotten the passcode, but you'll usually need to factory reset the phone.
To unlock your iPhone from its carrier, you'll likely need to contact your carrier directly to cancel your contract.
How do you get the data off your phone if you have accidentally dropped it and smashed the screen? Find out what's possible and what isn't.