Follow these steps
- Go to Settings > Screen Time.
- Tap Change Screen Time Passcode, then tap Change Screen Time Passcode again.
- Tap Forgot Passcode?
- Enter the Apple ID and password* that you used to set up the Screen Time passcode.
- Enter a new Screen Time passcode, then enter it again to confirm.
But, if your iPhone is disabled or in a security lockout, the only way you can get out of that is to erase the device.
If you're running iOS or iPadOS 15.2 or higher you can do that without a computer, see this for the instructions:
If you're using an eSIM, contact your carrier before trying these steps and ask for a QR code to set up your eSIM again.
- From your device's Lock Screen, try to enter your passcode five times until the "[Device] Unavailable" screen appears and your device asks you to try again later.
- When you're able to, continue to enter your passcode until the "Security Lockout" screen appears and you get the Erase [Device] option in the bottom corner of the screen.
- Tap Erase [Device], then tap Erase [Device] again to confirm.
- Enter your Apple ID password to sign out of your Apple ID on your device.
- Tap Erase [Device] to permanently delete all of your data and settings.
- When your device restarts, follow the onscreen instructions to set up your device again, restore your data and settings from a backup, and set a new passcode.
If you can't follow these steps, you can use a computer to reset your device.
If these steps aren't working or you're running a lower iOS or iPadOS version, please use a computer to get out of the security lockout
See this link for the instructions on how to do that
If you've forgotten your iPhone passcode – Apple Support (UK)