The effects on Iran are not side-effects. They are clearly the primary goal.
Just take a look at the extraordinary pile of wealth and power the fake theocracy in Iran has thefted away via Setad (about $100 billion stolen from the Iranian people). Reuters has done great investigative reporting on this over the years:
It turns out Khamenei is nothing more than a Putin-like kleptocrat, a thief, using religion as a cover for building a massive corporate empire on the backs of the poor Iranian people (from which he aggressively steals property). Everything about modern Iran makes sense once you read about Khamenei and Setad.
The people in the bottom 99% are the only ones who can change these countries. If you could take most of the personal wealth of the members of eg the Maduro regime in Venezuela, it would change absolutely nothing. They ultimately rule by gun, through military control. The majority - including large sections of the military - has to turn against the leadership to spur change.
Countries have no moral obligation to support the Maduro or Khamenei regimes (which is what happens when you freely trade with them and prop them up through hundreds of billions of dollars in foreign investment and oil purchases). Someone will reply to this and say: well the US is exactly the same as Maduro and Khamenei (or worse). The only proper response to that is: ok, sure, boycott or embargo the US, give it your best shot.
If the head of that state (and party elites etc) don't meet the requests of the sanctioning states, the ensuing poverty can mobilize the impoverished masses. This can backfire and drive them to further nationalism/jingoism, but it opens a window of opportunity for the opposition (and, more cynically, covert agents and external forces).