"Dir" is the second person singular dative personal pronoun as well as the second person singular dative reflexive pronoun.
For example: "I bought you (2nd person singular dative = "dir") a new coat."
Reflexive example: "You bought yourself (2nd person singular dative = "dir") a new coat."
Ihnen is the third person plural dative personal pronoun as well as the second person formal personal pronoun.
For example: "We got them (3rd person plural dative = "ihnen") a romantic dinner."
2nd person formal: "We would like to present you (2nd person formal dative = "Ihnen") with this certificate.
Remember, if it's 2nd person formal, "ihnen" will be capitalized. Also, all 2nd person formal forms in German are identical to 3rd person plural forms. The only difference is that the pronoun is capitalized.
My guess about Google Translate is that, without the question mark, Google expects you to continue (eg, "How are you... able to cope with such a tragedy?") into perhaps a more formal question, whereas with the question mark, "how are you?" is more commonly informal than otherwise.
Note: I'm a native English speaker and learning German myself, so this information may not be entirely accurate. But, to the best of my knowledge, it is.