I've had good experience with red cedar for bridge timbers. The key to a long life is always good drainage; either on good ballast or off the ground on a base that doesn't allow water to collect - just like the full size railways, in fact. I also use a wood preservative (a zinc naphthenate type) and have yet to see significant decay on samples that have been exposed for six years continuously. I've seen cypress recommended, but it's not always easy to find.
I've used recycled plastic lumber for heavier (non model railway) work, and found that the stability is a problem if it's exposed to direct sunlight. A length of it left leaning against a wall on hot day will end up close to an L shape - it happened to me! In a damp, well shaded area, it's great. It you support it at more frequent intervals than you would for a wood structure, it's not bad, but I wonder if the dimensional stability would be good enough for model structures. I don't think I'd trust it as an unbraced column to support track. It's easy to cut with a carbide tipped saw blade, and takes screws well.
Andrew