Is that just the 335 or also the single turbo and non turbo 330 325?
the N53 and N54 both suffer with the issues I've mentioned, so that's N/A and turboed models.
You can easily get conned when buying a pre-facelift 325i/330i, because they made facelift cars from early to mid 2007 onwards at the same time as pre-facelift were being phased out - so also put the facelift N53 engine in the last of the 2007 prefacelift cars, as well as the original N52 engine, and you can get a pre-facelift car upto to 2009 IIRC, with the N53 engine, then the physical looks based facelift comes into play with the different headlights and rear lights etc.
I'm 90% sure that this is a coupe specific issue IIRC, as the saloons and tourings were made from 05 onwards, so had the N52 earlier and for longer, I'm pretty sure by the time the facelift came in on them, they all would have had the N53, but don't quote me on that, as I'm a coupe guy when it comes to a 3/4 series.
N52 engine E92's have a proper hydraulic rack (I'd imagine the saloon and touring do too, but check), the N53 engine cars, have an awful electric numb feeling rack, that fails just like the 1 series - IIRC it's the same rack.
If you get a 2006-7 N52 engine 325i/330i, they don't have those issues, but there is still a fair few things that go wrong due to mileage/age that are costly to replace, like both DISA valves in the inlet manifold, the starter motors can just fail without any warning on N52/53/54 engines, and you have to take the inlet manifold off to change it, unlike older engines where you could be underneath the car and get to it on a ramp.
All of the engines have a very expensive £465 electric waterpump + a £180 thermostat, the waterpumps fail, again without warning, so replace them straight away along with the starter motor - and whilst you've got the inlet manifold off, you'd be silly not to replace both DISA valves, as 1
will have play, and when they fail, the break up and go into the engine, and are made of plastic, so it's only a matter of time.
The DISA valves are around £450 each for genuine, and there's 2 of them where it's dual VANOS, Febi Bilstein ones are £190 each, it's up to you which you want to fit/trust.
The teeth on the N52 and N54's valvetronic motor's sprocket, blunt/chip/fail - any secondhand ones are all the same and knackered. A brand new ones is around £1300, and the last time we looked, there was only a handful left!
I wont bore you with everything that needs replacing, be it age/mileage related, or known to fail; but there's a fair bit, even on the more reliable N52 - if you look on Youtube, there are various 25 minute videos listing/showing all the parts, and often giving pricing.
The N52 cars are more expensive to tax at £430, but worth it over the nightmare N53 that's £315 to tax. The N54 engine (335i pre-facelift) is £730 to tax.
TLDR, the 335i has all the problems of the ***** N53 engine + 2 turbos, so even more expensive to fix + they are well known to destroy the crankshafts, it's a matter of catching it before it's too late and replacing the bearings, but by now, age/mileage wise, I'd expect most cranks to be scored/close to being on the limit of saving, especially considering most have been tuned, poorly, using silly generic flashmaps, versus proper tuning on a dyno for that individual car.
They make big power easily, so it's very easy to shorten the lifespan of the engine/stress it out more.
Anything that's had decats, aftermarket downpipes, JB4 flashmaps, any remote sign of chavy mods, I'd run a mile from - the problem is, most people flash them back to standard/make the car stock appearance, so it's harder to find out if it's been messed with in the past, until you plug it in with BMW technican diagnostics - of which 90% of BMW owners have a pirate copy of and know how to use to cover their tracks.
I have considered one many times over the years, but it simply isn't worth the cost in tax, or the endless money pit to keep it going.
The injectors that fail, all do it, do not believe anyone that states that "the latest index ones fixed the problem" - they don't, they'll fail again and again, for the entirity of the ownership, as will the HPFP, never revised part ever fixed the issue; oh and because it's direct injection, you will have to have wallnut blasting etc done to clean everything out, and then it'll come back in a few years, again.
325i/330i wise, ignore the stuff surrounding the engine bays, as one appears to be a E92 and the other isn't. But the easy way to tell if you've got a N52 engine, is that the valvetronic motor will be visable on the rocker cover - it's that buldge sticking out to the left, in the left photo. So left picture is N52, right is N53:
As for N54's aka 335i, you can again find many videos on what fails/needs replacing. Just remember, as aforementioned, it's like the rubbish N53 + turbos, so even more to fail + what already fails on the N53
If you do look into the engines and what is required to keep them going, try and ignore every video made by 'BMW Doctor' he's a bell end, who thinks he knows everything, and tries to charge 'members' for knowledge/software that is freely available elsewhere, along with dodgy homemade remaps, or generic flashmaps, and often is wrong with anything that he says

There are many alternative videos, with enough information to give you an unbiased guide of what will go wrong/should be replaced at X miles
I hope all this waffling helps you
IF it was me, I'd get an F32 435i/440i, £315 or £330 to tax, better N55 engine in the 335i, and the B58 in the 440i - however, both have stupid electric steering racks that all fail eventually and cost thousands to replace.
Do not buy an early B58 engine 440i, the exhaust or inlet camshaft fails (I forget which) and they all do it. 'Some' 435i N55 engines can suffer with killing the bearings/crankshafts.