A Medium creature can guard a 10-foot-wide passage, if they can stand in the middle.
A Medium creature controls a 5ft area. Another Medium creature which they are hostile to, cannot pass through this space using its movement. (A friendly creature can pass through this space, but cannot end its turn there.)
- A creature can squeeze through a space that is large enough for a creature one size smaller than it. Thus, a Large creature can squeeze through a passage that's only 5 feet wide.
So a Medium creature can squeeze through a 2.5ft gap, & a Large creature can squeeze through a 5-foot gap... however:
- While squeezing through a space, a creature must spend 1 extra foot for every foot it moves there, and it has disadvantage on attack rolls and Dexterity saving throws. Attack rolls against the creature have advantage while it's in the smaller space.
Now, consider that almost any Medium creature has a 5-foot reach, in addition to the space it controls. Any hostile creature within 5 feet of that creature's space provokes an opportunity attack if it leaves that 5-foot reach.
If a Medium creature with a 5-foot reach stands in the middle of a 15-foot-wide passage, it is able to use its reaction to make an opportunity attack against any hostile creature that passes by.
If a Medium creature with a 5-foot reach stands in the middle of a 10-foot-wide passage, it it is able to use its reaction to make an opportunity attack against any hostile creature that passes by, and a Medium creature passing by is "squeezing through", & therefore spends 5 extra feet of movement, & has disadvantage on Dex saves & any attacker gets advantage against them; so the guard gets a good chance to attack any Medium-sized enemy. (If the guard has Readied the Grapple action, they can attempt to halt the enemy's movement instead.)
If a Medium creature with a 5-foot reach stands in the middle of a 15-foot-wide passage, a Large creature can squeeze through the 5 feet on either side; spending an extra 5 feet of movement, & provoking an opportunity attack with advantage.
If a Medium creature with a 5-foot reach stands in the middle of a 10-foot-wide passage, a Large creature cannot squeeze through the 2.5 feet on either side. (The Large creature might use its action to shove the Medium creature though, & then use remaining movement to pass by.)
The 5-foot grid is an optional rule, but even on a grid this can still be possible:
The player & GM decide precise positioning, not the grid. If a player specifies that they are pressed against a wall, or in the middle of a space, it is the GM's discretion to dictate what is within reach. The GM can put things directly on grid-lines if they want, & likewise can allow a player to do the same; especially if the location is easily understood, like "the middle of a hallway"!
A 10-foot wide hallway could be positioned so that 5-foot spaces run the middle of it, with the spaces on either side cut off at 2.5 feet each.
Either way, a Medium creature only "blocks" a 5-foot space, but any other creature passing within 5 feet of that space, on either side, might get killed.
(Or if the Medium guard has Grapple readied, the other creature may see its movement become 0.)