Answer
The words, ?Allah Hafiz? and Khudda Hafiz? are Du’aas commonly used for saying ?Allah protect you.?
There is no wrong in bidding farewell to someone in this manner. However, it would be better if one learns the Sunnat Du’aa and method of saying farewell, that is, ?Astawdi-u llaaha deenakum wa khawaateema a?amaalikum?
and Allah Ta’ala Knows Best
Mufti Ebrahim Desai