AFAIK this is the most definite answer to "perfect distance" you can get:
citymania.org/tools/profit
As for passengers, there are several factors that make them so good.
1. It's essential two-way cargo. While you can do two-way with other cargos it requieres a more complex setup, and incurs more transfering delays, so payment is less.
2. Passenger wagons are usually quite capacious, so even though payment rate for 1 unit seems low, it gets better when you calculate for 1 wagon. And towns (well, if not too small ofc) generate a lot of passengers, much more than any industry.
3. Passengers weight less, so trains accelerate faster, travel time is less and payment is better.
Though, while passengers bring a lot of money, I'd say they aren't the most profitable cargo. Usually you can do better with, say, goods in a long run. But pax/mail is perfect for starting route as it pays more for the same amount of effort.