I have had a 2006 S40 for about five years. I haven't owned a Mazda3.
Here's my take:
Engines:
IMO, the turbo is the way to go on the Volvo. Not much of a hit in fuel economy or reliability, but the turbo 5 is smooth and pulls very hard from 1500 rpm for a car of this size from this era. An overall durable engine, but has a few issues. Mine was almost destroyed when a seized A/C compressor snapped the serpentine belt and chunks of the broken belt got in the timing belt. I'm getting close to 250k miles and it's still running great with minimal problems.
I haven't had any PCV issues with my T5 yet (nearly 250k miles). Doesn't seem like a show-stopper to me. If my PCV has problems, either a new diaphragm (cheap) or a whole flame trap assembly ($200?) should sort it.
I think Mazda 4 cylinders from this time period are some of the best engines ever. I owned a Fusion with the related Duratec 2.5 and those things are great. Not nearly as powerful as the T5 Volvo, but should run forever on basic maintenance (I expect).
Transmission:
I don't know of any issues with either brand's transmission. My S40 is a six-speed manual and I think the shifter+clutch is a bit clumsy feeling. Not really the thing for banging out fast shifts. IMO, a car of this size is a lot more fun with a manual. I imagine the MZR engine would be a real hoot to drive with a stick shift.
Interior:
Volvo interior is very stylish and "grown up". But the foam in the headliner and door panels rots out after 15 years. So the headliner will need replacement and the door panels may be a bit floppy. I imagine the Mazda interior will hold up much better but will look a little more juvenile. A well-optioned S40 should give a lot of nice luxury features. But not all models will have those options.
The base audio in the S40 is very bad; the premium audio is very good. Both are integrated with the climate control and are difficult to upgrade. By 2008, you should at least have an aux input.
Exterior:
Volvo styling is more sensible and refined. 2010 Mazda3 has a goofy "grin". For whatever reason, I don't see many S40s with rust, but lots of rust on Mazda 3s.
Chassis:
Similar, many shared or similar suspension parts. S40 might be a little nose-heavy with the bigger engine. S40 probably has more sound dampening as a "personal luxury" car. Mine has the sportier factory suspension.
Other stuff: I think the S40 is a good choice if you are a DIYer and you like the idea of a quirky 5-cylinder. With the turbo, it is a much faster car than the 3. But it has some problems. Common ones I've experienced are sunroof drains that come unattached and flood the interior, and cheesy plastic clamps on the lines to the heater core that fail and spray the ECM and interior with coolant. Then there's a badly-designed upper radiator hose that should be replaced.
If you are able and willing to deal with its quirks, the S40 doesn't have to be a money pit. But if you will need to take it somewhere for service, I think you'll be happier with the Mazda. However, with used cars, the condition of the individual vehicle is key!
Oh, one more thing -- premium fuel is recommended for the S40, but not required. I use regular (87) in mine.