If you back up your music and files, wipe the hard drive, and install fresh, you will have all the settings reset. Then move your personal files back (or download from iCloud).
The first will erase all your files and settings then, if you are running Sonoma, result in a Mac running Sonoma which is ready for you to setup as you did when new. At this point you will need to restore all your files from your backup.
The second method will erase everything then download from the internet, the version of macOS that your Mac had installed when purchased. After installation finishes you will also have to set up your Mac again and restore your files.
I recommend that you make sure you have all your files backed up. This is especially important if you use the “Optimize Mac Storage” setting. I also made a list of all my installed apps and made note of many of my settings.