To answer your direct question: No, it doesn't matter whether trains run on the same side as road traffic in the same area does -- except, of course, for trams that run mixed with road traffic.
It doesn't even matter much whether trains on one line run on the same side as trains do on other lines in the network. It is less confusing for everyone if there's a consistency between different lines in a system, so usually each country has a convention anyway, but it's not as if it's unsafe to have parts of the system operate on the other side, and this does happen in some places for various reasons.
Having different conventions on different stretches of road would be a major safety risk, because all drivers would need to remember what the correct side for the particular road they're on is, and mistaking it could easily be disasterous. But train drivers don't control which of the tracks they're running on; the switches are controlled by the signaling system, which ensures that trains won't collide (unless they run a red signal) -- so there's no failure mode where trains crash into each other because one driver was mistaken about the rule of the road.
In most places the signaling system is constructed such it enforces running either on the left or on the right, unless special emergency working procedures are used. This is cheaper to build than bidirectional signaling where the signaler can choose to send any train running either on the left or on the right. In the recent several decades it has become common to install bidirectional signaling on new lines where any kind of traffic density is expected, but this is mostly for flexibility in case one of the tracks is temporarily out of service; in usual operations the same convention as the rest of the network is followed. And many existing lines still have signaling from before computerized signaling made it economically feasible to make every track bidirectional.
Some examples of special cases:
Trains run on the left in Sweden but on the right in Denmark. The two networks are connected by the Øresund bridge, and for engineering reasons the changeover point between left and right is at a flyover a few kilometers north of Malmö central station. So several double-tracked lines within Malmö use right-hand running like Denmark does.
One branch of the tram network in Gothenburg (also Sweden) is a converted railway line and does not feature any street running. The railway already had platforms between the tracks, and since the trams are unidirectional, they only have doors on the right side of the vehicle. So on that particular branch trams run on the left -- opposed to the rest of the tram network which run on the right like road traffic does.
A few short sections of the London Underground run on the right for historical reasons, or -- as in the case with the Victoria Line around Euston -- to provide covenient same-platform interchanges with other lines.
Similarly, a short stretch of the Munich S-Bahn (between Ostbahnhof and Giesing) runs on the left, because trains reverse direction at Ostbahnhof and it would be operationally inconvenient for them to need to cross paths while doing so.
Fully separate urban railways may run on a different side from the norm in the country they're in. For example the metros in Milan and Brescia run on the right, in contrast to mainline railways in Italy running on the left.