Look closely at the card and it tells you exactly what to do.
Advance token to nearest railroad
Pay owner twice the rental to which he/she is entitled. If railroad is unowned, you may buy it from the bank.
Advance means you are moving forward on the board, so this will always move you to the railroad that you run into. In your example, it means that you would stop at Pennsylvania.
From what it sounds like, you are reading way too much into a simple card. In the game of Monopoly, there is no way to go backwards, so you never look behind you when you are trying to calculate distance.
To break it down from the Chance spot that is in the light blues, the ranking of railroads in terms of distance is
- Pennsylvania (8 spaces away with normal movement)
- B. & O. (18 spaces away with normal movement)
- Short Line (28 spaces away with normal movement)
- Reading (38 spaces away with normal movement)
The only time you can pass go with that card is on the Chance spot right after the Short Line spot on the board.
You always need to remember that when playing a board game (unless specifically stated) you calculate distance based on the direction you move.
As for the comment about the Go to Jail card, it does not instruct you to advance to jail. That card is specifying changes to the movement rules on the card because it wants you to treat it differently than other cards that direct you to move to a location.
Go to jail
Go directly to jail
Do not pass go
Do not collect $200
There are other cards which break the movement rules, and those cards fully describe the changes to the rules.
Go back 3 spaces
This card clearly describes a movement that is outside of the normal rules, and does not use the word advance so it can't be confused with normal movement.
Official Tournament Rules where passing go a second time by this card is not mentioned even though it does mention passing go a second time from this space
GO Each time a player’s token lands on or passes over
GO, whether by throw of the dice or by drawing a card,
the Banker pays the player a $200 salary. The $200 is
paid only once each time around the board. However, if a
player passing GO on the throw of a dice lands 2 spaces
beyond it on Community Chest, or 7 spaces beyond it on
Chance, and draws the “Advance to GO” card, he/she
collects $200 for passing GO the first time and another
$200 for reaching it the second time by instructions on the
card.