Resetting iPhone without losing data is possible by performing a reset that doesn't erase your content, such as settings reset, or by backing up your iPhone before a full reset. Here's how to do it step by step. Firstly, you can reset your iPhone's settings without affecting your personal data.
How do I Reset my iPhone without losing e… - Apple Community
Reset All Settings: If the issue persists, you can try resetting all settings on your iPhone. This will not erase your data but will reset all personalized settings to their default values. Go to Settings > General > Transfer & Reset > Reset > Reset All Settings and confirm the action. Note that you will need to reconfigure your settings afterward.
How do I perform a complete factory reset on an iPhone? I need to factory reset this phone completely so I can pour it over again [Re-Titled by Moderator]
I have an old iPhone and don't have to Apple ID to erase info to give phone away. How can I reset? [Re-Titled by Moderator]
If you can't follow the above steps (e.g., you are using an older iOS version), you can use a computer to reset your device, as described in this article --> If you forgot your iPhone passcode - Apple Support .
Change or reset your password - iPhone & iPad - Gmail Help
If your device has iOS 15.2 or later installed, you can reset it without a computer; check out this link→ How to reset your iPhone, iPad, or iPod touch when you forgot your passcode - Apple Support.