It should be safe.
Any Android device shipped with Android 5+ has encryption turned on by default and since Android 10 File-Based Encryption is compulsory which is a stronger protection.
If they reset the phone, apart from formatting, the encryption key gets erased too. If they try to modify the software (e.g. rooting, custom recovery or ROM) the Knox bit gets triggered and the phone automatically deletes all your data as per my knowledge.
So if they don’t guess your PIN correctly or use an unpatched vulnerability, which is highly unlikely, they can’t access your data.
That’s good to know. Also from a quick search it seems that Samsung devices have by default locked bootloaders now, which means that my 2nd sentence in my 3rd paragraph is totally irrelevant because if they were flashing unofficial software or recovery they couldn’t boot it up anyway.