Sorry but if your passcode isn't working you have no choice but to reset your phone. Hopefully you made backups you can restore from.
If you forgot the passcode on your iPhone, or your iPhone is disabled or unavailable -
Click on the link for instructions on how to reset your passcode without a computer if you have iOS 15.2 or higher.
If you see a iPhone, iPad, or Apple Vision Pro unavailable message or Security Lockout screen - Apple Support
Click on the link for instructions on how to reset your passcode using a computer.
If you forgot your iPhone passcode or your iPhone is disabled - Apple Support