I haven't owned a diesel X5 but I have had two petrol versions (4.4 Sport and 4.8is) and both were excellent.
I'd look for one with a full BMW service history and then check for the obvious signs of imminent work being needed: - smokey exhaust, tyres wearing unevenly, cars doesn't handle (these cars are not sports car but will embarras a lot of 'sports sedans', so they should handle well) and any switch that doesn't work.
There were a batch of diesels that had turbos that went but if you're buying a 3-4 years old, this shouldn't be an issue because it should have blown by now; however, if you can extend the BMW warranty, it is money well spent imho.
In terms of resale, Comms Pack is a must (SatNav, fixed phone, etc) and manual cars are the kiss of death.