Use smart switch on PC to do this. Will restore latest official firmware and reset everything back like it's a new phone
Here's a step-by-step guide:
Install Smart Switch: Download and install Samsung Smart Switch on your computer (PC or Mac).
Connect your device: Connect your Samsung phone to your computer using a USB cable.
Open Smart Switch and select "Emergency software recovery and initialization": In Smart Switch, navigate to the "More" option, then select "Emergency software recovery and initialization".
Initiate device initialization: Click on "Device Initialization" and follow the on-screen prompts.
Put your device into Download Mode: You will likely need to power off your device, then hold down the volume up and volume down buttons while connecting the USB cable.
Smart Switch will download and install the firmware: The software will automatically detect your device and download the latest firmware.
Wait for the process to complete: The firmware installation may take some time, and your device may restart multiple times.
Setup your device: Once the process is complete, you can set up your device as new or restore your backup.