Whether in office or WFH, getting ahold of people works almost the exact same everywhere:
1) ping them to see if they're at their desk
2) go and talk to them
Very rarely are people going to just get up and walk over to someone's desk that they need to talk to. The only case in which this is true is when the people are within sight of where you are and you can see they're there. This breaks down as companies get to a certain size or building distribution.
To further exacerbate the issue, people who just walk up to you and interrupt you don't understand the importance of flow and how difficult it is to get into and out of a flow state so you're working efficiently. These are the unseen penalties of working in the office that just kind of get glossed over in these conversations I feel like.