Let's just clarify one thing: in your Internal Storage (not SD card), different system folders have different meaning:
/system: that's basically where your OS is placed, along with system apps you can't uninstall without using a root file explorer and other core things. I believe it is automatically wiped when you flash a new ROM
/data: that's where apps you install and their data get stored. When you choose to do a "factory reset" or "data wipe", this folder is cleaned. Basically, changes you did get erased, but your system remains untouched. It is a good habit to clean this folder too when you change OS, as retaining the same exact app on different ROMs may result in an unstable or unclean system. Plus your apps may not start at all, as some apps have different version for various ROMs, or create different data for them. To avoid losing everything, various apps for backing up exist.
These folder are separate partitions at all, so there's no risk of damaging one when touching the other.
In the great majority of cases the
userdata) partition include your personal files, such as photos, music and downloads. Just some devices (like Xiaomi ones) separate those things into an emulated SD so that you can do a factory wipe to clear apps and apps data without losing your Documents, with the downside of having a limited space to install apps in.
If you want to delete all old apps, but keep your documents, and dedicated apps don't work, this is my advice:
With a root file manager, delete the content of
/data folder (this will erase apps and apps data, it is like a factory wipe limited to insalled apps)
/system folder using your recovery
Flash your new ROM
Be careful to do step one only when you have everything ready to perform step three, as it may break your current system. If you want to remove apps but you want to save your saved data (like progress in games), use dedicated apps like