diesel bmws are pretty unreliable out the box to be fair mate.
i suppose you'll be looking at 3 series not 5. specifically they have swirl flap failure on the diesel turbo (google it) and also EGR valve failure, also another quite large show stopper. that said preventative maintenance on those parts costs sub £200 and then the car is reliable.
their electronics, suspension/ride and options are excellent. my mate ran his 320d upto ~130K from 70K without servicing and on vege oil.
5K would get you a 2001/2002 with 60-80K 3 series, 320d, you want to get the SE spec or higher. the E or ES is poverty spec. you need to make sure you get the sports leather seats also or byebye resale.
cheers.