Trapped has a sense of "no escape" while something else bad can happen.
Stuck just means, more or less, that you can't make further progress. You can get stuck working a Soduko problem, but not trapped. If your front door is jammed shut, you may be stuck inside until someone comes to fix it, but you're not "trapped" unless there's a house fire or some sort of homocidal maniac in the house with you.
With the enemy closing in on three sides, and the only bridge across the river destroyed, they were trapped.
If you're on an island and the bridge goes out, you're stuck there.