WASHINGTON — The Iranian and North Korean nuclear programs, drastically different but often spoken of in the same breath, are now being thrust together, as President Trump’s determination to kill the landmark 2015 accord limiting Tehran’s capabilities is colliding with his scramble to reach a far more complex deal with Pyongyang.

For years, as the Iranians watched the North Koreans build an arsenal and make deals with the West only to break them, they learned what the world was prepared to do — or was unwilling to risk — to stop them. More recently, the North Koreans picked apart what Tehran got in return for agreeing to a 15-year hiatus in its nuclear ambitions, weighing whether the promised economic benefits were worth giving up its nuclear capabilities.

The North will be watching especially closely in May, when Mr. Trump will face another deadline on deciding whether to abandon the Iran deal, which he has called a “disaster.”

The same month, if all goes as Mr. Trump plans, he will head into a face-to-face negotiation with North Korea’s dictator, Kim Jong-un — the first time an American president has ever spoken with the leader of that country — confident in his ability to do what his predecessors could not: persuade the North Koreans to denuclearize.