This depends on the car, on the part, and on the part manufacturer.
OEM parts cost more, but often this is an up-front cost well worth paying, both for the sake of quality and durability.
Some cars have certain parts that should never be replaced with anything different. For instance if you've got, say, an early-GM-era Saab with the Ecotec-based 4-cylinder, then there is one, and only one, spark plug that you should use on that engine.
My Porsche more or less demands OEM parts when needed, except for aftermarket systems on the car, but this one is old enough that there is a really good parts network for the car.
My Nissan has always gotten OEM parts, but sometimes aftermarket are fine. Sometimes aftermarket are both better-quality and cheaper, e.g. the Brembo rotors on the front. I used to avoid cheap Chinese rotors, then I heard (from the community) of racers getting a whole weekend out of a set of cheap Chines rotors - if they're good enough for that, they're more than good enough for street use.
Within the aftermarket world, all brands are not created equal - some manufacturers make much better parts than others.
For charging-system parts, alternators especially, OEM is the way to go. Aftermarket remans are notoriously bad; it's a crap shoot whether that alternator will last 6 months or 5 years, but it's not going to last like an OEM reman. Or if you know a good rebuild shop that uses high-quality parts, get the old one rebuilt yourself. Or, if you can still get the parts from the automaker, rebuild it yourself.