There are two issues here:
The ranged characters can shoot past any number of other creatures - they just have +2 or +5 to their AC depending on if you rule they have half or three-quarters cover.
Your players are stupid. There are any number of ways to deal with this situation; standing still and hacking away is the most stupid of them.
A whole mess of better options are available including:
- Having someone behind the lead fighter cast Guidance on them every turn.
- Create space behind the lead character and have them grapple one of their opponents and drag it into that space to be turned into mincemeat from both sides.
- Retreating back to the previous room so the party controls the choke point.
- Shoving the creature in front so they can force their way into the room.
- Rotating the lead character so they can benefit from healing etc. and get rotated back.
- Using spells that physically move the creatures out of the way.
- Moving forward into the vacant space when you kill one.
- Spider Climb or Wildshaping into something with a climb speed and going over everyone's head.
- Physically climbing over the top.
- Teleport, Dimension Door, etc.
- And so on and so forth.
- Retreat back down the corridor, lightning bolt the skeletons when they follow.