I sometimes have the same problem.
But my reaction will usually depend on the context.
If im not particularly close to them (physically) then i'll just say hi, or if im in a crowded corridor for instance and we're walking in opposite directions (if we stop then it will bring the whole crowd to a stand still).
But in most other cases (unless im very close (in a friendly way) to the person and we can have a chat; or i havent seen the person for a while) then i usually just say "Hey, you alright? Oh, How was XY or Z?" and if they respond and im not sure if they want to have a chat or not, then i'll look at my phone at the time and say "im really sorry but im in a bit of a rush at the moment" (i may not actually be in a particular big rush, but i am usually trying to do something/get somewhere) "but ill see you later at XYorZ" (if im planning on meeting them somewhere or "would you like to meet up at XY or Z?" (if i want to chat with them about something and am not scheduled to meet with them in the near future).
However if i feel i need to talk to them about something fairly urgently then (unless im in a very crowded/noisy place) i let them decide whether or not they want to chat with me.
Im not entirely sure whether this helped you in your question as i've forgotten what you asked in the first place lol