To do a factory reset on Galaxy S20, S20+, S20 Ultra, and Z Flip, go to Settings > General Management > Reset > Factory data reset. Then tap Reset and Delete all.
You can also use hardware keys to perform a factory reset. Turn off your phone, then press and hold the Power/Bixby key and Volume Up key, then press and hold the Power key. Release the keys when the Android mascot appears. When the Android system recovery menu appears, use the Volume Down key to select “Wipe Data/Factory Reset” and press the Power/Bixby key to proceed. Select Yes and proceed again. When the factory reset completes, select “Reboot System Now”.
At this point data recovery is still possible by a forensics analyst, to ensure data can not be recovered. You can start filling the phone with random data to overwrite anything that could be recovered.
For example, you could download one of these Linux ISO’s and copy it over to your phone, rename the file, and copy it over again and again until the phone is full, now perform another factory reset and you can rest assured your data is completely gone and not able to be recovered.