Hi Anna_Sutterer.
Sorry to hear that you forgot your iPhone passcode, but unfortunately, no matter what method you use to unlock it, the data will be erased eventually, cuz this is how Apple designs their product, but you can try to reach out to Apple support first, provide them with the information they need, see if they can unlock it, but so far didn't see anyone succeed before.
Still, if you have a backup, you can unlock your iPhone with some method first and then restore the data back to it.
Now I will provide some methods for you to try to unlock your iPhone.
If you see a iPhone, iPad, or Apple Vision Pro unavailable message or Security Lockout screen - Apple Support
If you forgot your iPhone passcode, use your Mac or PC to reset it - Apple Support
Method 1: Restore iPhone Using iTunes or Finder to Unlock iPhone
Pur iPhone In Recovery Mode:
- iPhone 8 and later: Press and hold the Side button and a Volume button until the power off slider appears. Turn off the phone. Connect it to the computer while holding the Side button until you see the recovery mode screen.
Restore iPhone with iTunes or Finder:
- Open iTunes or Finder.
- Select your iPhone.
- Choose the “Restore” option to erase all data and reset the device.
Set Up iPhone:
- After the restore process is complete, set up your iPhone as a new device or restore from a backup.
Method 2: Unlock the iPhone From the Lock Screen(only for iOS 15.2 or later, find my is on, connect to a network)
- Input the password incorrectly five times on the lock screen until "Forgot Password" appears.
- Select "Forgot Password" and then "Start iPhone Reset."
- Sign out of your Apple ID and tap "Erase iPhone" to initiate the factory reset process.
If iTunes or Finder is not available for you, or your iPhone is not on iOS 15.2, or find my is not on, not connecting to a network, then you might need to try other methods, you can google it, there are many tech-site is proving some solutions, you can check out this, this might suit your need.
how to restore/unlock iphone 15 if forgot your passcode