While there is usually no reason to change your iPhone or iPad passcode, the hardest time to remember your passcode is right after you have changed it. And sometimes your passcode may be unknowingly changed for you by a prankster. As a helpful backstop for such situations, a new iOS 17 feature called Passcode Reset lets you use your old passcode for 72 hours.
To utilize this feature, tap Forgot Passcode after you have tried the wrong passcode five times. Then enter your old passcode and create a new one.
If you are certain you know your new passcode, you can choose to expire your old passcode sooner in Settings > Face ID/Touch ID & Passcode.