If you search online you can usually find fake graphs showing which years of a given model had the most/fewest issues. Take them with a grain of salt though unless you look at a bunch of them (and look at what it actually says, if the problem was something fixed under a recall or whatever, it's essentially a non-issue for you).
The best way though is to find an enthusiast community for whatever model of car, and do your research there.
Often though, a good rule of thumb is that the models most prone to issues are often the first few years of a major revision. For example, my car is a 2001, and that major revision / body style was made from 2001-2007. There are a couple known issues that my car is prone to that were fixed by the 2003 model.
Hindsight is easiest with cars at least 5-10 years old though, so if you're trying to see if (for example) a 2012 model or a 2013 model is better, that will be much less clear.