The primary function of the esophagus is to serve as a conduit for food and liquid. When swallowing occurs, a series of coordinated muscle contractions, known as peristalsis, propels the food toward the stomach. The esophagus also acts as a barrier by preventing the backflow of stomach contents through structures called sphincters, which regulate the flow at both ends. Additionally, the esophagus plays a role in sensing and responding to swallowed substances, thereby protecting the airway and ensuring that food does not enter the lungs.