That phrase used to mean something - you found out someone's friend or relative died and you were genuinely sorry for their pain.
But now, it is so overused it is just like "have a nice day" or "call me" or "how are you?". It is said but not really meant for anything but making conversation.
If it is going to be used, why can't it sound more like, "I'm sorry for the loss of your [mother, father, wife, son, etc.]?