Any of the TDI's motors will go 400K+ miles with proper service, so no worries there. If they had timing gears instead of belts, you would never have to do anything other than oil changes.
Regardless of what some people will tell you, ALL 04-06 unit injection tdi's (BEW, BHW, and BRM engine codes) will need a cam. I work on them for a living and change cams on a regular basis in the PD motors. I've had numerous cars with maintenance records you could wipe a white glove on that still needed cams before 150K. I did one that had 55K on it and the chamfer on the edge of the lobes was already gone. Last one I did was an 05 passat that had 205K on it; it had .116" worn off the cam LOL.
Once you fix the cam, they're great motors. However, it's a $850 job if you do it yourself. So figure that into the price of the car.
My personal favorite is the ALH engine in 00-03's. It's the 94-98 12v cummins of the VW world. Simple, reliable and durable as hell, easy to turn up, and parts are very plentiful.
Only word of caution with 02's is some, not all, of them had defectively manufactured cams and/or lifters from the factory. First signs is the lifters spider on top and the edges of the cam lobes wear down. It's relatively easy to spot with a flashlight with the valve cover off. However, doing a cam in an ALH takes 2 hours tops and costs less than $275 if you do it yourself. It's not nearly the hassle it is with the PD motors.
The ALH's will usually get 3-5mpg better than any of the unit injection (PD) motors also.