Grief is extremely personal and differs from person to person, even if you have experienced a comparable loss. Saying “I know how you feel” can turn the discussion from the person who is mourning to you. If you have a different relationship with loss than they do, it could also come across as haughty or cruel.
What to say instead:
“I can’t imagine what you’re going through, but I’m here for you.” Showing support without making assumptions goes a long way.