The Pan-American Highway is about 48,000 kilometre long depending on the route you take. There are many options in the United States, Canada, and Mexico because of the large amount of area and number of roads. Central America has only a few roads going north to south.
The Essential Guide to Driving North, Central and South America provides recommendations for travel gear, vehicle modifications, medications, and theft prevention, specific border crossing procedures, information by country, tips for traveling with a dog, and a full list of online resources for travelers exploring the Americas by vehicle. The book is available at www.ramblewriter.com.
If you drive by personal vehicle, it is important to know that your vehicle must be shipped from Central to South America (or vice versa) in order to travel around the Darien Gap. While your vehicle is shipped, you can transport yourself by plane or boat. Driving the Pan-American Highway is certainly possible, and many travelers complete the overland journey from North America to South America (or vice versa) each year.
Trains are not a viable option because most Central and South American countries do not have international train lines.
Try to avoid areas where cartels operate. Follow the advice for the area you are at. There are many dangers, like wild animals, forests, swamps, and there might even be dangerous criminals hiding in the forests or the swamps.