Not sure if you're going to like how am I going to answer this question, but let me try.
Outcomes of wars depend on financing, motivation/zeal, and the resulting firepower and manoeuvre.
Not sure if you're going to like how am I going to answer this question, but let me try.
Outcomes of wars depend on financing, motivation/zeal, and the resulting firepower and manoeuvre.
This is about the only things making wars 'comparable', though: the more one studies every single of these factors, the more different they are. That's why different wars might be 'comparable' but are never the same.
Iran was perfectly able to remain capable of financing the war imposed upon it by Iraq - unless the oligarchy that imposed itself in power during the civil war of 1979-1983, became so deeply corrupt that is squandered billions necessary to continue financing the war:.
Presently, Ukraine is not able to finance the war imposed upon it by Putin, but is surviving thanks to Western financial support. That said, the war is still going on and thus Ukrainians still have plenty of opportunity to make themselves capable of financing the war on their own.
Motivation... the fact that both Iran of 1979-1983, and Ukraine of 2000-something until today are, actually, in a state of 'civil war'. However, people of Iran and people of Ukraine were/are not fighting for the same thing.
Iranians fought for survival of their country/nation. Ukrainians are fighting for survivl of their country/nation. But, that's where similarities end.
Next to nobody in Iran fought for ideals of the Islamic Republic, and even if: they had no clear idea what should the latter have been. Their oligarchy exploited this situation to its own advantage, continued fuelling the war while subverting the republic from within, and, eventually, won the civil war (against political opponents) and then got its own way. Result: the Islamic Republic is a merciless dictatorship murdering its own people (always 'in the name of God' of course) - and that on behalf of oligarchy that is in charge.
Ukrainians have a clearer idea what are they fighting for: the civil war (the one pro or contra Putin's Russia) is over; now they're fighting for the republic, which is the same like fighting to become masters of their own future. To have outlooks, regardless what their oligarchy wants.
That's a fundamental difference, and as important for the following reason.
Certain circles within the Shi'a clergy of Iran (not even the highest ones, but the ones that had more men under arms, becuase they've had the IRGC on their side) and IRGC converted the patriotism and religious zeal of Iranians into a tool of (mis)using their infantry to overcome the most murderous obstacles Iraq threw in their way. This capability of that infantry to infiltrate and collapse Iraqi positiosns by night and then repel Iraqi counterattacks by day, was what 'won' (partially) a string of battles between 1982 and 1986. However, this was 'working' as long as it was making sense to that infantry (i.e. 'everyday Iranians') and the results were at least some kind of minimal advances. After five years of that, though, the IRGC became deeply corrupt and megalomaniac enough to lead that infantry into attacks that were little else but a mass-slaughter (see Karbala-4). At that point in time, overall results were not 'meagre', but too little: it beame obvious even to most fanatic Iranians that it's pointless to continue doing what the clergy and the IRGC were preaching them would work - which was: sacrifying themselves to prove to Allah that they are trying hard enough.
As mentioned above, Ukrainians have won their civil war. Now they are fighting for their republic and their future. Hand on heart: actually, that's a fight that never ends, but it does start with defeating the Putin's aggression and usurpation of large parts of eastern and southern Ukraine.
Where they do have the advantage (in comparison to Iranians) is that Ukrainians are receiving at least 'token' support of the West. This is sending at least enough weapons to stop Putin, even if not (yet) enough to defeat him. For comparison, Iranians were on their own: they've had nothing but IRGC's empty promises.
Therefore, when you ask if Ukrainians might be more successful than Iran was: they (still) have it in their hands and that is a giant advantage. For comparison, Iranians have left the control over their republic slip out of their hands.