My strategy is that when people start emotionally venting to me, I try to remember the "rubber ducky" trick. Which is often used in programming, but also other fields.
The idea is that making yourself explain a problem to someone else is a way of re-framing the problem, and that new perspective can lead to a solution. By replacing the other human with a rubber duck, you are able to do this without being reliant on someone else (or wasting their labor hours).
Personally, I have always done this internally to handle my own emotions, thoughts, and feelings. I usually don't externally express these things until they have gone through that internal review process. It's a tactic used in therapy, encouraging children to play with dolls and stuffed animals and such for example.
So when someone is talking to me, and especially if they seem emotional, I aka what they want from me. Do they seem like they would be receptive to solutions? Do they want some sort of anecdote to be assured that they are not alone, or to know that you are a qualified person to talk to about this? Or are they just looking for you to be a rubber ducky for them? This is the hard part- figuring out what they are looking for.
Being a rubber duck is incredibly easy and, in my experience, is what people usually want. Sometimes I'll just come out and ask if they want my help to think of, or execute, a solution to their problem before just spouting out ideas.