Supports can be played in either direction, though some feel better suited to certain roles. Symmetra is really strong on defense, less so on offense, for example.
Lucio, Zenyatta, and Mercy could be played either way. Lucio is particularly effective on king of the hill maps like Ilios, Nepal and Lijiang.
Offense and Defense are the ones that really are more limited on what they can do on certain runs. Generally, you wouldn't run Widowmaker on attack in Route 66, for example since there's no good sniping position anywhere on the offense side. Likewise if you're on defense playing Genji, you're going to have a hard time dealing with all the offense heroes like Tracer or Pharah, or the tanks.
In the high-end meta, almost no one runs defense and instead picks up extra support or tanks to disrupt. Right now this is because of McCree's burst. But Widowmaker and Junkrat do see quite a bit of play on some maps.