Each sport has different jargon for their officials, and some sports use them differently than others. Some sports (like football) use them all at once. There are some distinctions that tend to run across multiple different sports, not perfectly, but good enough to discuss.
Umpires tend to make binary decisions based strictly on the rulebook. Yes, sometimes there is some Grey area, like whether a batter “swung” or not. But the decisions are often yes/no.
Judges tend to make more subjective decisions, comparing against some sort of ideal rather than a binary decision. In most sports where scores are not accumulated based on goals but assigned by officials based on how well they perform their routine, those officials are judges.
Referees tend to make broader decisions that impact the overall game. They are also more likely to talk directly with coaches on either side, or the spectators.
And there is no perfect analogy. American football does have a “referee” who is the main official, as well as an “umpire” who has set duties, and all the rest are technically judges but enforce things like scrimmage violations and penalties in the secondary. When an announcer says “That’s probably a holding flag” it is because it is thrown by a judge who typically has responsibility for looking for holding. Baseball only has umpires, the one with the most seniority is the “crew chief” and acts sort of like a referee but they don’t call them that.