Hehe, I see a bit of a parallel between Ukraine and Afganistan... just not the one that America might have hoped for:
In both cases we have an external world power that is using military force to try to try to impose a government of their choice on the nation. (There are many differences too, so I don't want to over sell the parallel here)
But notice in both cases there are significant fractions of the population that view this as a fight for the survival of their nation. And as such they are willing to fight on and continue dying decade after decade.
NOTE: I am not saying America didn't have good reason to go into Afganistan. We could not leave twin-tower bombing groups free to continue training! I am just noting the futility of trying to force 'regime change' on a population that views your actions as an invasion.