As SydneyB pointed out, Iran helped fight ISIS in Syria, and Soleimani had a hand in those operations.
Iran and Syria are no friends of the U.S. by any stretch of the imagination. But: they are at least not as looney tunes as ISIS and other radical jihadist groups are.
It is a fact of life that Iran has major influence in Iraq, where we also have our own interests.
That's the problem with assassinating Soleimani. With this one assassination, we have probably ruptured any potential for future cooperation with Iran, maybe for a generation, when who knows, we might need them later. We can't predict the future. What if another ISIS-like entity arises, and Iran decides to support rather than crush them?
This assassination also plays right into the Iranian hard-liners' narrative. To them, the U.S. is and has always been "the great Satan." Moderate factions in Iran took a different view. But having killed someone as revered in Iran as Soleimani, we've proved the hardliners correct. Anyone in Iran seeking peace with the U.S. is now going to be sidelined, if not actually persecuted and executed.
Finally: what is going to stop Iran from seeking an atom bomb now? We've now lost all credibility with Iran in diplomatic terms. The only way to stop them now is through force, leading us on a path to war that few Americans and even fewer of our allies want.