Can you do a diagnostic first...
How to diagnose your phone using Samsung Members
Open the Samsung Members app and tap “Support”.Tap “View tests”.Tap “Test all” to start Diagnostics. Follow the on-screen instructions to test the performance of your smartphone. You can skip some parts of the process and return to them whenever you want.
If you then still need to reset your phone see here about how to proceed.
https://www.samsung.com/uk/support/mobile-devices/backing-up-and-restoring-data-on-my-galaxy/Once backed up, you can do a factory reset.