If you need to reset your iPhone to factory settings to resolve an issue, you can back it up to iCloud first and then restore it to keep your data.
Losing access to your iPhone’s Screen Time passcode can be a significant inconvenience, especially when it limits your ability to manage app usage, content restrictions, or device settings.