You just have to learn it. In the real life you should know by the context which is being referred.
It's the same thing with english, for example the word "dates". "For us those weren't the best dates for flying to US".
Did they go during off-season, or did they get food poisoning? (or maybe the dates were bad "For us" as in "For united states")
This is so weird. Even though the pronunciation of dùng in the South is practically the same as 用 in Mandarin, I can't get how it went from Middle Chinese jɨoŋ(H) to dùng, especially since d used to be pronounced [ð]. Even more surprising is 民 (MC miɪn), which became dân or rân in Vietnamese. I see there is a pattern there, it's just implausible.
This might answer your question https://forum.duolingo.com/comment/15112956/Are-D-and-Gi-in-Northern-Vietnamese-phonetically-identical The "d" in Northern Vietnamese dialect sounds like an English "z". In Southern dialect it's pronounced like an English "y"