If you absolutely have to hand over your phone, turn it off completely, like hold the power button and then tap the off icon. That will dump any keys out of RAM, which is why it always requires the full password to unlock when you turn it back on.
Both in terms of how your phone works and the leaks we've seen, the cracking tools the police have are overall significantly less likely to be successful when used on a phone that's been turned off and not unlocked since.
Also, IIRC iphones have a feature where they will dump at least some of the system keys from RAM if you push the lock button five times. I'd still trust fully off more but that's easier to do covertly.
Additionally, with the Pixel 9 holding down the power button no longer turns it off, you have to press power and volume up at the same time to get to the power menu.
There's usually a hardware level power off function for when the device freezes and stuff. Can usually hold the power button for ~10 seconds will power off the device without needing to look at the screen