The U.S. was actually able to occupy a country on the other side of the world at minimal cost for 2+ decades. Russia can’t even occupy a bordering country and it’s entirely because of de minimis fiscal transfers from the U.S. to Ukraine
The US could not hold Afghanistan even dragging NATO along with it, and with the full blown support of Russia, Tajikistan, etc. Plus tacit acceptance of their presence there by China, Iran, and Pakistan. The Taliban were basically surrounded on all sides by countries with governments which did not support them. What support they did have was informal and provided by non-state actors.
The US used to joke about the Soviets losing in Afghanistan, but at least the Soviets managed to pull off an organized withdrawal, which is more than the US could do. The US withdrawal was a total debacle comparable with the collapse of Saigon in the Vietnam War.
Ukraine had hundreds of tanks, hundreds of billions of material support delivered to them. The Taliban had no such thing.
Wait until the bill for replacing that military equipment sent to Ukraine comes. And then you will cry. Those hundreds of billions sent to Ukraine will require a cool trillion to replace. They started with small arms costing several thousand, then million, then it was ten million dollar tanks, and now it is hundred million dollar jets.