Looking up information on both procedures, it seems that an Upper GI x-ray series diagnoses the same things an EGD would, but for less cost while being less invasive. Besides for biopsy, when is an EGD superior to an x-ray series?
EGD is more accurate for just about all applications. UGI series are x-ray pictures (aka ‘shadows’), which may or may not clearly show structural abnormalities like ulcers, tumors, or enlarged esophageal veins. With the EGD, one gets up close for a real good look in real time, adjusting distance, focus, and angle at need.
EGD also allows intervention, such as with bleeding ulcers and veins. The scope can be used to inject medications to try to halt the bleeding, or throw in a few clips to try to stop it that way, too.
Endoscopy is vastly superior for things that involve surface changes not “thick” enough to make an indentation on a contrast study. An example would be Barrett’s esophagus, where what you are looking at is a change in the type of cells lining the esophagus.
A contrast study, especially if combined with a cine or time-delayed films, might be more helpful for certain types of mechanical problems such as evaluating the swallowing mechanism, or how long food sits around before your stomach manages to empty it.
As a rule of thumb, (as pointed out by Q t M) endoscopy is more sensitive for most things.
With a 'scope you can actually look and see what your innards look like (as QtM stated). With an UGI you can see what the esophagus, stomach and duodenum do (like Chief Pedant said).
Some other things that a UGI might reveal that a 'scope wouldn’t would be aspiration (we always do an esophagram with the UGI), reflux, or maybe a leak after certain types of surgery.
Given my druthers, if I needed to have my proximal guts evaluated, I’d opt for 'scope first, then a UGI.