The Heidelberger Bergbahn is a two-step railway that takes you to the mid-section and the top of the hill overlooking Heidelberg. Total cost of a round-trip ticket is seven Euro.
The first section runs for roughly 1,550 feet and was opened in 1890. It was originally built by the same guys who built the water-fed ballast system in Wiesbaden at the Neroberg. It's been updated greatly (it has to carry a ton of customers up to the castle), and makes the trip in five minutes. It's an electric train today.
The second station runs another train from the mid-level of the hill to the top.....over 3,000 feet long, and has run since 1907. It's basically the same train (1907 model) with no upgrades or heat. This takes about half-as-many customers and while very scenic in nature....there's nothing else at the top except for a small beer and soda stand.
If you are a technology geek or historian type....it's worth the trip to the top and you ought to ride on both trains.
The suggestion of walking down from the mid-point (castle-level)? On a nice day, it's a short walk (maybe an hour) and would be a good way to end the day. I wouldn't drag kids along on this type of outing. Walking from the top of the hill down? Don't even think about it.
Saturdays and Sundays are hectic and crowded with tourists.
A final note, there's no place around that I'd suggest for lunch (at the castle or at the top)....the food is such that I'd recommend you wait until the end of the trip before eating lunch or bring along a snack.