Exactly if you read the book from Lester Grau "The Soviet-Afghan War: How a Superpower Fought and Lost", you get a glimpse of the logistical challenges and how the Russians performed namely their airborne troops and other special forces. The decay of Soviet economy ultimately forced the leadership to withdraw.
I hope we get a comparative analysis, note that the western intervention faced less enemies and had more tech in the form of UAV etc.
Well, it won't really be fair to compare the Soviet-Afghan war with the US intervention unless you do so in relative terms after adjusting for a lot of factors. The Soviet Union spent 10 years in Afghanistan while USA spent 20, so yearly averages would be the way to go.
It is clear that the US-led coalition, also thanks to new military technologies (drones, satellites, LGBs and so on), conducted a less human intensive campaign in Afghanistan. Yet, the difference (10,000 men) is not as high as the technological divide between 1989 and 2001 (or 2015 or 2020) would suggest.
The US-led coalition losses are massively lower than the Soviet ones. The reason is not only the use of new technologies but also the fact that the two factions waged a different kind of war on Afghan soil. The war waged by the Soviets and the Democratic Republic of Afghanistan was a TOTAL WAR. It was ideological in nature and aimed at establishing a socialist one-party state with no internal opposition.
No class or religion-based dissent or compromise could be accepted during (and after) the establishment of atheist, egalitarian, one-party socialist republic.
The Soviet war was thus waged against a great part of the population, political compromise was intrinsically excluded and total victory required a total war against an enemy with a large social presence and legitimation.
Americans fought against a specific group, the Taliban, popular in particular among one specific ethnic group, the Pashtuns, while despised by minorities such as Tajiks, Hazara, Uzbeks, Balochs. Furthermore, America, trying to learn from the Soviet mistakes, saw right away the necessity to lead a political process centered around compromise between different ethnicities, social groups, and sensitivities. The West did not rule out talking with Islamist factions (more moderate than the Taliban, but also less than the Muslim Brotherhood, such as Hezb-e Islami Gulbuddin). Another signal of such compromise is the fact that the Republic established after the overthrow of the Taliban in 2001 was named "Islamic Republic of Afghanistan". The US tried to keep as much as possible the war limited to the Taliban while compromising with other factions.
The Soviet approach to the war was brutal, the tactics and strategies employed so violent, that even for wartime, people could regard them as......questionable, to put it mildly.
The US spent way more money than the Soviet Union did. The payoff was clearly higher when it comes to military and civilian casualties, the political returns though are disastrous, as is evident by recent events.
45 days Vs 2 1/2 years. The difference seems even more striking when you consider the fact that the Soviets had a SMALLER army and faced MORE enemies than the Americans.
All in all, it was a shitshow then and it is a shitshow now. It was the death blow for the Soviet Union, and while the US may survive, it has received a knockout blow. Neither of them emerged from this looking good.