Buying used doesn't make a whole lot of sense, but if one were to do so...
If it doesn't have autopilot already, and you want it, can you add that after the fact to a car without it? Is there a year / model minimum for doing so?
Every Model 3 and Model Y is autopilot and "full self driving" capable from a hardware perspective... But see the Software section below too.
For the S and X, there are three different groups of vehicles:
1) No autopilot. Model S from its introduction in 2012, through most of 2014, is in this group. It has no cameras and is not upgradable to any version of autopilot. There won't be any cameras inside the top center of the windshield.
2) "Hardware 1" autopilot. Model S and X from 2015-2016 are in this group - Some of the late 2014 models are in this group, and some of the late 2016s will have Hardware 2 since Tesla doesn't really do model years, but 2015-2016 is the general rule. These cars will never be "Full Self Driving" capable. They can do basic Autopilot, plus basic "Summon" (pulling forward and reverse in/out of tight parking spots with nobody in the car). They only have a front camera at the top center of the windshield, and are not upgradable.
3) "Hardware 2" and later, 2017 and later. These have an 8-camera setup. I think they're about up to Hardware 4 now... But anything with at least Hardware 2 is upgradable since it's only the CPU and not the cameras that have been upgraded since Hardware 2, and that upgrade is included if you pay for the FSD package (whether it's already paid for or you buy it later). These can be identified by the cameras pointing aft from the side turn signals just in front of the front doors. They also have cameras in the B pillars.
It's also worth knowing which software a car has. There are a few possibilities here too:
1) No autopilot. Even in cars with the hardware, for a while having any autopilot was optional. A Model 3 purchased in 2018, for example, may have Hardware 2 or 3 but does not have the autopilot software unlocked at all. And, of course, any car without the hardware is gonna be in this group too.
2) Basic autopilot. All Hardware 1 cars are in this group. On newer cars, this was optional for a while and now comes standard. The functionality here is basically traffic-aware cruise control (TACC) that will vary your speed, all the way down to zero and back up if necessary, to keep you from hitting any vehicles in front of you or merging into your lane, plus auto-steer which will stay in your lane and avoid hazards coming from the sides as well. Plus, there are the fairly standard (for new cars) safety features like lane departure avoidance and automatic emergency braking that happen whether autopilot is turned on or off. Finally, the Hardware 1 cars can also do basic Summon as described above.
3) Enhanced Autopilot. This was available off and on starting with Hardware 2, standard on S/X and optional on 3/Y. In addition to the basic autopilot functions, it adds the following: Navigate On Autopilot (NoA) which will automatically change lanes and take ramps as necessary to follow all of the highways on your route, before telling you to take over when it takes the last exit to surface streets. Automatic lane changes - If you want to change lanes, tap the turn signal stalk and it'll check to ensure the lane is clear and move over for you. Autopark - Exactly what it sounds like, will automatically park for you, both parallel and perpendicular. Basic summon as described above.
4) Full Self Driving. This has always been a paid-for option on Hardware 2 and later cars. Includes all the features described above, plus has Advanced Summon which will drive from a parking lot to pick you up at a store entrance for example (not on public roads yet). If you participate in the FSD Beta program, you'll also get (today) "city streets full self driving" which will obey traffic lights and signs, etc allowing you to go mostly fully self driving, though like most of these features started out it's still a bit "drunk teenager" at this point and definitely requires supervision.
Hope this helps!