Welcome to Android Central! Which phone? If it's a Samsung, try using Find My Mobile to remotely unlock it: https://findmymobile.samsung.com/. Otherwise, you're essentially out of luck. You'd have to do a hardware key factory reset in order to reset the password, and that of course will wipe the phone.