Having gone from a gas F-150 to a Ram 2500 diesel, there is a significant difference, but based on the maintence schedule of the diesel, I'd almost personally be reluctant to buy a used unless I could get a complete service history.
My '18 Ram was the last year before they switched over to the CP4.2 in the 2019's, and I know Ford has been running the CP4's for years with some issues in fuel failures by what some people have posted on THIS forum with repairs costing in excess of $10K.
With my truck, it calls for replacing but fuel filters at 10K miles and about $100 a pop on Amazon for OEM replacements. While there are people such as myself who see the benefit of as least maintaining the fuel system integrity, there are probably thousands who don't, and that's where I think you risk a ticking time bomb buying a used.
I can turn a wrench on most things to save the dealer costs, but if someone can't do the work and they decline to have the dealer do the work just because it costs significantly more, then this is where the time bomb lies.
Having a diesel is kinda like having a puppy. You have to get yourself in a routine and retrain yourself like you have to train a dog. If you do it right then you should get several 100K miles out of it. Owning a gas truck is like having the old dog that sits on the porch that generally doesn't require a lot of tending to.