You can unlock your Android phone even if you've forgotten the passcode, but you'll usually need to factory reset the phone.
Forgot your Android password? Use Google’s Find My Device to reset it remotely, or try a factory reset via the volume and power buttons. Samsung users can unlock their phones using Find My Mobile if ...