Swallowing and the epiglottis
The pharynx is a shared chamber: both the oesophagus, which leads to the stomach, and the trachea, which leads to the lungs, open into it.
Figure to be added
At the entrance of the trachea is a small movable lid, the epiglottis. When a bolus is swallowed, the epiglottis closes the trachea, so the food goes into the oesophagus instead.
Choking
People have died when food or water lodged in the pharynx instead of entering the oesophagus: the epiglottis stays shut over the trachea the whole time. If the food is not removed at once, the airway is blocked and the person can die.