Esophagogastroduodenoscopy, commonly known as EGD or upper endoscopy, is a medical procedure that allows doctors to examine the lining of the esophagus, stomach, and the first part of the small intestine (duodenum). This procedure is essential in diagnosing, monitoring, and sometimes treating various gastrointestinal conditions, including cancer.