At this time, there is no way to reset the passcode of your iPhone without erasing it first.
———
I understand that you are referring to the passcode that is used to get to the Home Screen of your iPhone. You will have to reset the passcode to your iPhone by following the instructions in this guide published by Apple 👉 If you forgot the passcode or if your iPhone has been disabled. You will need a computer to execute this procedure and all the data on your iPhone will be erased.
Hopefully, you have a backup created on 👉 iCloud and/or on a computer. If you do then, you can 👉Restore your iPhone from the backup file once your passcode has been reset and the iPhone has been returned to factory settings by the procedure in the link above.
If your iPhone or iPad has iOS 15.2 or higher installed, then review this guide published by Apple 👉How to remove your iPhone passcode without a computer
Axel F.