I think the answer depends on the context.
In short, while a state from around 1750 (and a cultural and trade crossroads since ... forever) - until the cold war Afghanistan was essentially a buffer between India and Russia and by and large 'happy' in that role. The Russian invasion (a result of fear of losing this buffer) changed things.
The Russian withdrawal left a power vacuum that the US failed to fill, despite their support for the Mujahadeen the US subsequently withdrew leaving the Taliban free to pursue their own agenda.
Today, Afghanistan's main party piece is as a key conduit for oil pipelines - by allowing pipelines to terminate in Pakistan it avoids the need for Caspian basin oil from being piped through Russia, Azerbaijan, China (a political and logistical nightmare) or worse (for the US) Iran. This way, the US stands at least some chance of exerting some control.
While the US has a strategic interesting in keeping Afghanistan onside and it would be a blow to lose Afghan cooperation, it likely wouldn't be catastrophic. Once must also consider the 'bigging up' of Afghanistan's significance by the Bush administration (and before that), members of which stood to gain from a compliant Afghan regime.
Mexico is a different kettle of fish. While drug trafficking to the US is a problem it shares with Afghanistan, and a problem for the US, it has wider interests in keeping Mexico 'stable' and 'secure'. As its neighbour, there are issues of immediate self interest and national security which don't really apply to Afghanistan. These would trump concerns over the narcotics trade.
Ditto for Canada. Not that I'm equating Mexico with Canada, but the same basic principals apply. In other words, if your neighbour's house is on fire ...