Modern diesels are garbage due to their emissions technology. Oftentimes it costs an arm and a leg to fix that stuff, so lots of situations where you either delete those things or write off the vehicle.
The used market of the older diesels proves this, early 2000s trucks are crazy expensive because they are the last models without emissions stuff