Opportunity Attacks
Rules glossary
You can make an Opportunity Attack when a creature that you can see leaves your reach using its action, its Bonus Action, its Reaction, or one of its speeds. To make the Opportunity Attack, take a Reaction to make one melee attack with a weapon or an Unarmed Strike against the provoking creature. The attack occurs right before the creature leaves your reach. See also “Playing the Game” (“Combat”).
Use it at your table
Gatherune's D&D 2024 character sheets show this rule as a card where it applies, in the SRD's own words.