The usual rule is not to switch point of view within one scene. Readers get confused and feel that the writer is bouncing them around like a ping-pong match. “Who’s thinking this?” “Who’s saying that?”
It can be a simple thing. For example —David heard the doorbell ring —- when you’re in Susan’s head. Or a minor character will suddenly know something —-Fred guessed it was Sam at the door—-” The end result is a confused reader.
A very skillful writer can get away with switching point of view in a scene. While they’re in the head of the lead character, they slowly switch to another character by spending a lot of time on that character and then switching.
I’d never try it. I’m not that skillful and I want my readers to stay right with me.