I don't want to defend or excuse any harmful comments I may have told my friends, so I will ask them to be honest with me and I'll try to learn from it. I've been thinking about this, though and I don't know what Serenity is dealing with and I would never want to do anything that might seem to trivialize it, so please don't take this as being comparable to anything, just that it's a way to, kinda, test how I'd feel on the receiving end.
Anyone here knows my dogs are important to me and I lost one of them in August. About a year prior, a really good friend lost her dog she'd had since it was a pup and an affinity for dogs is something my friend and I have in common. Both dogs basically died of "natural causes" so that does take out of this the element of questioning why, so I won't address the "it happened for a reason" thing, however, my friend did tell me that she understood how I felt, and I knew that she did. Far from it bothering me that she told me, "I know how you feel", it helped me to know that she had been where I was.
I will say that I totally agree that you shouldn't say that if there's really no way you could know what someone else is going through. That very same friend lost her dad, too, and, as my parents are both still living, it would have been dumb on my part to tell her I understood how she felt, because I didn't and don't.