I keep hearing that this is frowned upon, but I cannot help it. After I share, I circle back and explain how and why I connected the two stories to try to recenter the other person. Is this annoying? How do you want ND people to respond in that case?
I thought no a good way to do it is to ask questions. Like, if you use only superficial statements, then yeah, it's only surface shit. But people bring up stories because they want to talk. Asking questions about it let's them talk more and let's them get into more depth. The more they talk the more they feel like it's not surface level. Questions like, "how is the rest of your family taking it?", or "are you sleeping ok." I don't know, something.
I also like the suggestion above of relating your story very briefly but bringing it back to them. Like, "last year when my mother died I found the most comforting thing I could do was xxxxx. What are you finding bringing you the most comfort?"
Or something like that. So you still get to relate your empathy through your experience but leave it with a question for them at the end.