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 used to do this, and once I became conscious of the fact that I was doing it, I now make a conscious effort to just not come off like I'm trying to one-up the other person or make it about me. That's the most important part.
People generally respond very well to short, sympathetic stories when they are looking for comfort. If you have any doubts, a simple "I've been there and I know how you feel" is always going to be acceptable.