Both countries have been at the centre of US wars, and are plagued by insurgencies fighting against local security forces trained by the American military.
The seizure of several major cities by jihadist rebels has taken the Iraqi government by surprise and alarmed the international community, leading to fears that Afghanistan could one day face the same fate.
"Never, not all," Karzai told the BBC when asked whether what was happening in Iraq could happen in Afghanistan.
Karzai will soon step down, ending his rule, which began in 2001 when a US-led invasion ousted the Taliban regime for sheltering Al-Qaeda leaders behind the 9/11 attacks on New York and Washington.
More From This Section
The NATO combat mission in Afghanistan will end in December after 13 years of fighting the Taliban insurgency.
The next president will be under pressure to open talks to bring peace, and Karzai said he was in daily communication with the Taliban.
"There is even an exchange of letters, meetings, and desire for peace," he said.
But Washington recently said only 10,000 US troop would remain next year and all would be pulled out by the end of 2016.