Long time ago I’d use a third party app for that, but I don’t really trust them enough for that now. The closest solution I found was to use the work profile with Shelter, would that be the way to go?
In my case the app is Facebook Messenger & phone is Pixel 6.
I think Samsung devices also had a built in way to do this
Samsung does have a way to do this, secure folder. It’s different in some ways to the work profile but functionally the same