It depends on whether you are using an SSD drive with Trim or a standard hard drive. Erasing on an APFS formatted SSD could be safer compared with an HDD.
The sectors where the file had previously been stored will be designated as accessible if the deletion occurred on an HHD. In actuality, the deleted file will typically still be present on the medium until a new file takes its place in the sectors that belonged to the deleted file. This indicates that the old data has been overwritten. Hence, the deleted data can be recovered before it is overwritten.
While on an SSD, the enabled Trim by default tells the operating system which data block can be erased when it is no longer in use, and thus it zeros out the used block when a deletion operation occurs. So it is harder to recover deleted data from SSD, but there is still a possibility to recover from Mac SSD before Trim removes unnecessary data when the Mac is idle and no program is using the drive.
Therefore, to avoid recovering from APFS hard drives, you can randomly save lots of files to the APFS drive after erasing it to overwrite data on the drive deliberately. Then, even if the third-party data recovery software is unable to recover the previously erased data from the APFS drive.
In case you accidentally erase APFS volume, recover with iBoysoft Data Recovery ASAP!