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.
You can recover deleted photos on iPhone from the Recently Deleted folder in the Photos app or a backup on iCloud, iTunes, or ...
There are plenty of ways to back up your PC, but you probably didn't know you can use DISM to do it. Here's how it works.