Upper endoscopy, or esophagogastroduodenoscopy (EGD), is a diagnostic procedure that allows physicians to visually examine the upper part of the gastrointestinal tract using a flexible scope. It is commonly used to investigate symptoms such as persistent heartburn, bleeding, nausea, and difficulty swallowing, and can also be employed for therapeutic interventions like removing polyps or foreign objects.