For NATO combat troops, Iraq and Afghanistan differ in several important ways. For one thing, nearly all the fighting is out in the countryside. In Iraq, most of the combat was in urban areas. Moreover, Afghanistan has many very different rural environments. There are heavily populated (by farmers living in villages or clan compounds) river valleys, deserts (often not far from the river valleys), and mountains (both barren and forested.) Some of the mountains are very high, but most are similar to the American Rockies.
The other big difference is that the Pushtun tribesmen, that comprise most of the Taliban, are resourceful and determined fighters. Not suicidal like the Iraqis, the Afghans will run away if they are getting the worst of it, and often plan their departure. Overall, the Pushtuns are more determined (although not much more effective) fighters.
The Afghans are also more flexible and resourceful in their tactics. But like the Iraqis, they also use intimidation, and murderous reprisals, to keep local civilians in line. That means the civilians will rarely snitch on the Taliban, and will often supply shelter and food for the Taliban. While the Taliban are seen as outsiders to most Afghans, they are outsiders who can blend in, and will promptly kill anyone they don't trust. Most Afghans would like to see the Taliban gone, and the need to put platoons of American troops in hundreds of villages at a time, is the main reason why the American commander wants another 40,000 troops. This plan cuts the Taliban off from supplies and information, and forces them to attack the villages containing U.S. troops. The Taliban are the likely losers in this kind of war, but for the moment, there are not enough American troops to make it so. In the meantime, American troops have had to adapt, and stay one step ahead of the Taliban.
The most common form of combat has been the ambush. The Afghans have used this tactic for thousands of years. The availability of modern explosives has made the roadside bomb another powerful weapon for their ambushes. The prime targets for ambushes are targets that can provide the least resistance. In other words, supply convoys. Foreign troops have to devote enormous resources to protect these convoys. This has generally worked, but it means that about half the combat forces are occupied with this. Still, the effort does a lot of damage to the Taliban, for the enemy keeps trying to ambush the convoys, and American (and NATO) countermeasures (helicopter or UAV scouts, combat troops with the trucks and smart bombs always on call) have made such ambush operations higher risk than the Afghans are used to. The Russians, in the 1980s, were much easier targets. But the Russians didn't have the UAVs, and most of their troops were poorly trained conscripts.
Another thing the Russians didn't have was analysis. The Americans have developed a powerful geek weapon with the use of databases and analysis of Taliban operations. The Taliban know of this, but they have few mathematicians or Operations Research (OR) practitioners to come up with countermeasures. The geeks can quickly detect patterns in Taliban operations, and this often leads to the ambushers getting ambushed. In cases like this, the only thing that prevents the Taliban from being wiped out is their greater speed and agility on the ground. The Taliban don't wear body armor, and carry all the other weight of the foreign troops, and can scramble away. Many are killed anyway, but many of those die providing a rear guard for others. This is a tactic the Iraqis rarely used. The Afghans have a warrior ethos, which the foreign troops respect. Still, the Taliban take ten times the casualties of the foreign troops they fight.
Foreign troops have also figured out that the best way to deal with an ambush on foot troops, is to go on the attack. This unnerves the Afghans, although the older ones remember the Russian spetnaz commandos and parachute troops using the same tactic back in the 1980s, with the same success. Thus the Taliban will often call off an ambush if they sense that the target contains too many troops who will come right after them.