If the passcode is not accepted by your iPhone, it is possible that the passcode you are entering, although correct in your memory, might belong to a different device. Passcodes are device-specific and cannot be used interchangeably across different devices. For example, if you have multiple devices and each has its own unique passcode, entering the passcode of one device on another will not work. Always ensure you are using the correct passcode associated with the specific device in question.
Passcode Counter:
Passcode Lock Periods: The iPhone enforces increasing waiting periods after consecutive incorrect passcode attempts to prevent brute-force attacks.
1st four attempts will allow you to enter the correct passcode immediately without any delay. Subsequent failed passcode attempts will result in longer lockout periods:
Failed Attempts:
- 5th: 1 minute (iPhone Unavailable)
- 6th: 5 minutes (iPhone Unavailable)
- 7th: 15 minutes (iPhone Unavailable)
- 8th: 60 minutes (1 hour) (iPhone Unavailable)
- 9th: 90 minutes (1 hour and 30 minutes) (iPhone Unavailable)
- 10th: 120 minutes (2 hours) (iPhone Unavailable)
Depending on settings, the iPhone might erase itself or lock indefinitely, requiring a connection to a computer for a reset.
Correct Passcode Resets the Counter: If you enter the correct passcode after any number of incorrect attempts, the counter resets, and the phone behaves as normal. Future incorrect attempts will restart the count from the beginning (e.g., after five incorrect attempts, entering the correct passcode resets the count to zero).

Passcode
Your data is not lost if you have a backup either on iCloud or iTunes.

If you see an iPhone or iPad unavailable message or a "Security Lockout" screen
If you forgot your passcode, you can use your Apple ID and password to erase and reset your device without a computer.
Learn what to do if you see "[Device] unavailable" or "Security Lockout" on your iPhone or iPad.)

iPhone is disabled.
Following this process is the only way out if your iPhone is disabled. The steps given in this link will help you reset the passcode -> If you forgot the passcode for your iPhone, iPad, or iPod touch, or your ...

Regarding your data…
- If you have an iCloud or iTunes latest backup, then there is nothing to worry about. If not read more...
- You have synced your data to iCloud, then what you will get back is what you have synced to iCloud and uploaded to iCloud Drive; the information that is synced and stored in iCloud are, Contacts, Calendars, Bookmarks, Mail, Notes, Voice Memos, shared photos, iCloud Photos*, Health data, call history, and files you store in iCloud Drive. (*-If you have turned on iCloud Photos, your content is automatically stored in iCloud.)
- You have imported your Photos and videos to Mac/PC then they are safely residing there on Mac/PC
- You have uploaded some of it to Cloud Drives using the Files app (iCloud Drive, Google Drive, OneDrive, DropBox, Flickr, box, AmazonDrive, Adobe Creative Cloud, etc). The data remains there.
- If you have not backed up or do not have the latest backup, nor imported nor you have synced or uploaded your data to cloud drives prior to the situation that you are in, then I am sorry, all your data is lost.
