Like television does, with cuts back and forth on story beats.
“Okay, you guys set to work rooting around for the McGuffin in the library. Meanwhile! Group B, what are you doing?”
Secondarily, encourage (remote) communication if the setting allows it. Give one group a clue that will help the other group, but it must be conveyed.
Like most of GMing, it’s an art. You get a feel for it based on the players and the system.
Follow one group until there’s a natural break in the action, or their need to make decisions, or just until the other group gets fidgety.