Help me please! Safari for some reason is taking up 59GB of my iPhone storage?

Help me please! I think if I wipe my phone and restore from backup it would fix this problem but I have iCloud photos and optimize iPhone storage turned on and am not sure how to back up and restore with those on without losing all my photos and videos. I usually backup with iTunes but since I'm using iCloud photos do I need to actually back up with iCloud?

I don't know what to do since the full res photos are in iCloud and I only have thumbnails on my phone.

Try clearing the data and caches from the browsing datas

Open the Settings and scroll down to Safari. You'll find a "Clear History and Website Data" item. If you're running an older iOS version it might be buried in Safari's Advanced settings.