Brene Brown has created this video to explain the difference between sympathy and empathy. You may have seen it already, but if not, give it a look. Offering empathy is a skill we can all develop, and it feels good for everyone involved.
Developing empathy can feel hard because we can feel pressed to respond to the distress we see in front of us, pressured to make it go away. I wrote recently about acronyms to remember when we find ourselves in challenging situations. Here's another. In those moments when someone shares their pain with us, we can WAIT. Ask yourself before you say anything: Why Am I Talking? Consider if your words are necessary. Maybe they are. Maybe they're not. Maybe your quiet presence is enough to start. And if you need to say something, maybe you can start with something like: "I'm right here with you." Or "Thank you for telling me." Or "You can say whatever you need to here."
Give yourself a break. Your being right there with that person, not sure of what to say, but hearing their heartbreak--that's a wonderful gift to them, a balm for their wounds.