Many games can just swap devices on the fly (from the top of my mind, Elden Ring, Witcher 3, Lords of the Fallen, Dirt Rally).
This gets a little rickety when you have permissions tied to input devices, which is not uncommon in households with young children.
Also for some games it’s just generally buggy.
It's not the game. You just press the PS button and then you can turn off the controller that is running out of battery from a system menu, turn on another and go back to the game. At least on the PS4 and 5.