Because both Iran and North Korea are facing the "enemy" of the world's number one power-the United States. In terms of conventional weapons, it is far from the United States, and it is impossible to reach a balance of power in a short time. This determines that once Iran or North Korea goes to war with the United States, the situation will most likely be "one-sided". Therefore, only by developing nuclear weapons can we achieve "one step at a time" and shock the United States, and our positive forces can survive.
PS: Of course, this is only the unilateral view of North Korea and Iran. As for how the international community reacts and whether it recognizes it, we have to say two things ~ ~