In general, anyone whose Character Alignment tends toward the lawful — good, bad, dumb, or neutral — will be liable to this trope. Conversely, tricksier works or characters will often feature Exact Words, Loophole Abuse, or Bothering by the Book (sub-)versions of this trope. Be especially wary of how this trope will be used by any Literal Genie.
Arguably, though, the trope can be understood on another level: How an author treats people following extreme orders is important to the moral stance of a work. That is, as well as it being a throw-away line, the concept is treated seriously in some works.
We're used to the negative side take: For example, soldiers burning a village to the ground to deny an enemy army resources. When pressed as to the fate of the homeless starving villagers, they are "Just Following Orders."
The positive take on this trope, often related to the presence of those acting in a Lawful Good way, tends to slip by unnoticed. One example that comes to mind is in Band of Brothers: "Easy Company" moving into a position they know the Germans have their guns calibrated for. If asked why they are doing such a suicidal thing, they might have replied they were "Just Following Orders". Just wars are won by people following orders, too. Another time when it's nice to see orders obeyed is when the orders say things like, "don't murder any babies". After all, it's not as though war crimes always originate at the highest ranks — sometimes, it's the soldier and not the officer who needs to be shouted down, with orders being the only thing preventing a massacre rather than the thing that's going to cause one. For that matter, doing anything Lawful Good, including putting out fires or rescuing injured people, requires orders. (Really, the whole question of how to make good orders enforceable while leaving bad orders breakable is probably one of the dilemmas of any system of authority — and also a main moral hazard of Lawful Goodness.)
And of course, this trope tends to drive young people absolutely nuts. From the moment we are born, it seems, parents work around the clock to endlessly, redundantly instill into us the lesson that "You have to obey people who have authority over you, m'kay?" Nobody ever seems to bring up the possibility of moral ambiguity at that juncture, where it arguably would be most needed. Then, as soon as kids are old enough to learn about the Lawful Evil regimes of the world, they're suddenly informed that "Well, it's not good to obey people who outrank you if they're clearly bad people." Well, hell, who decides who is bad?! What if I think you're bad?! Does this mean I can disobey you if I think you're being bad? What if every order is bad? And so forth....
Expect Godwin's Law to follow if someone makes this claim to justify something morally questionable, due to the association with Nuremberg. Not to be confused with Subordinate Excuse. Note that, in Real Life, the Nuremberg defense is not valid in international law: the famous trials affirmed that when a soldier is given an unlawful order, they have a duty to refuse to follow that order. This interpretation is, in fact, Older Than They Think, dating back to 1799 in the United States military alone.