Hi,
Typically, an iOS upgrade should not cause the device passcode to become invalid. You can try the following steps to fix the problem:
Re-enter the passcode: Make sure you have entered the passcode correctly. It is possible that the passcode was rejected due to a typing error.
Restart your device: Try restarting your iPhone, sometimes this can solve some temporary problems.
Reset Passcode: iOS 17 offers the option to reset your passcode on-screen without wiping your iPhone, but this only works for 72 hours after changing your passcode. Assuming your passcode was accidentally changed, you can enter your previous passcode to reset a new one within the expiration date, and then use the new passcode to sign in to unlock your device.
This may be an iOS 17 bug, if your device does not currently have the latest iOS version installed, try upgrading to the latest version to see if this error is fixed.
If none of the above methods work, then you'll have to erase the iPhone.
Reference sources:
- If you see an iPhone or iPad unavailable message or Security Lockout screen - Apple Support (CA)
- https://www.isunshare.com/iphone-ipad/how-to-fix-iphone-passcode-not-working.html