On iOS, you can quickly ditch the current FaceID/TouchID session, and require a passcode for the next unlock, by holding power and volume buttons simultaneously for several seconds until the "power off" screen appears.
1. Check your “Emergency SOS” settings. It is possible to set it so that holding down those buttons like that initiates a countdown to an emergency call. Depending on the exact settings this may also be accompanies after a few seconds with a loud alarm.
If you are trying to surreptitiously disable biometrics this might be irksome.
2. I think these procedures were different on earlier phones or iOS versions, so test it out.
3. It also works to click the power button rapidly 5 times. That too can be set in the “Emergency SOS” setting to trigger an emergency call so check that before using it.
Holding power-volume-up for a second to reach the “power off?” screen is enough to kill Touch / Face ID instantly, at which point you can let go without having fired an alarm (unless you’ve gone and altered your alert settings, so test this when a loud noise won’t endanger you).
IANAL. But I believe it's not that easy. First it would have to be a foregone conclusion that you had contraband on your phone before merely locking it could be construed as obstruction. Then they'd have to demonstrate that you locked the phone at a time when you had reason to believe that you might be coerced to unlock it because it was a foregone conclusion that you had contraband. Are those likely circumstances? Probably not, though it will happen to someone, sometime, but when it does it will be because they did something stupid or because the cops overstepped their authority (in the latter case the process is the punishment, and it wouldn't be the cops getting punished).
iPhone periodically disables biometrics until you enter your passcode. They aren’t going to be able to prove that the reason the phone is asking now isn’t that.
The only similar thing I know of on Android is that 4 failed attempts with an unknown finger disables fingerprint unlock. So I can lock my phone out in a few seconds using my middle finger.
Android, or at least Pixel, similarly has a "Lockdown" mode, reached by long-pressing power. Unfortunately I think you do need to enable it in advance.