Khuda is the Persian word for the idols which they worship, and Hafiz comes from the Arabic root word hifz meaning "protection". So literally, means "May the (Persian idols) be your Guardian." They worship these idols even presently in Iran and other places. And when you say Hafiz
(protect) with it, you mean May Khuda (the Persian idols) protect you.
So insha-allah lets stop saying as such, and instead say Allah Hafiz.