Understand first, then offer advice
When someone describes a problem to you, you may want to suggest a solution straight away. Sometimes they're looking for one; other times, they first need to talk through the situation or feel heard. Before giving advice, ask: “Would you like me to listen, or should we look for options together?”
Empathy means trying to understand the other person's perspective, not taking on their emotions or agreeing with every interpretation. You can say, “I can see this is weighing on you,” if that fits what you've heard, and then check that you've got it right.
If the person wants advice, first make sure you have enough context. Ask about their goal and any constraints. Offer a suggestion as an option, not an instruction: “One possibility would be… What do you think?”
If you don't have the experience or expertise, say so openly. You can support the person by helping them work out whom to ask or what information they need. You don't have to have a solution to everything to be a good listener.
When a conversation involves a serious risk or a health problem, ordinary listening isn't a substitute for professional help. Help the person find a suitable next step, and respect your own capacity and boundaries.
Ask whether the person wants advice before offering it. If needed, explain where your experience ends.