Two Things I'll Never Say
Instead, how about "I was so sorry to hear about your father's death?" or "It must have taken a lot of sacrifices to go to Iraq and Afghanistan?" You know, something specific. Vagueness is recognized immediately for what it is: the fear of giving offense that, paradoxically, does offend because it treats the recipient as a commodity. They are treated as one of the "bereaved" or a "soldier, sailor, or airman" rather than an individual. I'd go so far, at least concerning "sorry for your loss," as to maintain it's better to say nothing at all.
I can't say how a member of the military might feel about "thank you for your service," but I've read that that they hear it so frequently as to be bewildered about how to respond meaningfully. It must feel very good to hear the phrase the first time, just as every beer bought for you in an airport terminal on your way to an assignment must taste good no matter how many times a civilian picks up the tab. In the latter case, though, at least the civilian made a sacrifice. In the former instance, they made themselves feel better at the cost of putting the service member on the spot. I can't know for sure, but I think a smile and a nod might be more welcome.