What you should do with a menuhax-based setup depends on whether you have any content on the menuhax-based setup that you would like to keep.
I want to...
A menuhax-based setup has everything on the SD card, so deleting everything from the SD card will effectively result in starting fresh. However, menuhax-based setups use an EmuNAND that stays on your SD card as a separate partition, so we'll need to do a bit of extra work to get rid of it.
You'll need your operating system's equivalent to administrator access to do this, so public or organization-managed computers probably won't work. If you don't have access to a computer where you can get administrator access, you can install custom firmware, back up your SD card files, use GodMode9 to format your SD card, then restore your SD card backup.
Section I: Repartitioning SD card
Windows
Press WIN+R to open the Run prompt
Type diskmgmt.msc, then press ENTER
Figure out which drive is your 3DS SD card, then right click a partition and click "Delete Volume"
Repeat this for every partition on the SD card until you see one giant block that says "Unallocated"
Right click on the unallocated block and click "New simple volume"
Click through the prompts until you are prompted to select a filesystem, then select "FAT32"
Now that your EmuNAND has been deleted, you can install custom firmware as you would on an unmodified console. Your SysNAND was probably on version 9.2.0, so that means following Installing boot9strap (Soundhax).
Your setup has been upgraded!
It is possible to copy all EmuNAND content to SysNAND, effectively transferring everything from your previous setup to a modern one. Keep in mind that your homebrew applications are likely to be very out of date or may not even work, depending on how they were created.
Section I: Removing menuhax
To install a modern custom firmware, we'll first need to remove menuhax. This'll render your current setup temporarily inaccessible, but don't worry - everything is still on the SD card.
Power off your device
Insert your SD card into your computer
Navigate to the /Nintendo 3DS/<ID0>/<ID1>/extdata/00000000/ folder on your SD card
You probably have multiple ID0 folders, so just do this same process for both
Delete the corresponding folder for your 3DS region:
USA Region: 000002cd
JPN Region: 000002cc
EUR Region: 000002ce
Reinsert your SD card into your device
Section II: Installing custom firmware
Now that menuhax has been removed, you can install custom firmware as you would on a stock console. Your SysNAND was probably on version 9.2.0, so that means following Installing boot9strap (Soundhax). Once you're done that page, STOP and come back here (you won't brick if you continue to Finalizing Setup, but you'd waste a lot of time).
Section III: Move EmuNAND
After a modern boot9strap+Luma3DS-based setup has been installed, you can move your EmuNAND contents over to SysNAND. Follow the instructions on 3DS:Move EmuNAND.
Your setup has been upgraded!
You can selectively back up certain data using your menuhax-based setup:
Once you've backed up what you want to keep, follow the "Start fresh" section as normal.
Extra: Restoring H&S
As part of your menuhax-based setup, you may have injected FBI into the Health and Safety application on SysNAND. If you still have this left over after migrating your setup, do the following:
Open FBI
Navigate to Titles, then select the red title named FBI
You can do a web search of the title ID displayed to ensure that it actually is Health and Safety that you're deleting
Select "Delete title"
Exit FBI
Open System Settings
Navigate to "Other Settings" -> last page -> "System Update"
Follow the prompts to update the system
This will reinstall Health and Safety from Nintendo's servers
After rebooting, Health and Safety (the exclamation mark icon) should be back to normal