Same thing happened with me on my S9 Plus the night I went to watch End Game, I opened the front camera but while clicking the photo accidentally pressed the Bixby button and phone started operating itself, sometimes notification tab was coming up and down, random applications started opening and on pressing power button and then on pressing restart it was going back to home screen, at the end had to forcefully restart it and everything came back to normal.
Happened just once and that too I was on latest Firmware. Felt quite embarrassing about it among my friends that device this expensive can also behave like this