Actually, it seems pretty clear that the Klingons don't
share a border with the Cardassian Union they are invading. Else why not invade across that border? It's not as if there could be Maginot lines in space - the best one can hope for in interstellar space is some sort of a warning network, such as the one the Feds supposedly have against the Romulan Star Empire. And even that one doesn't seem to work too well, as in "Face of the Enemy" the enemy is not detected!
Then again, invading Cardassia through Bajor means the shortest route imaginable from non-Cardassian space to the very center of the Cardassian Union. Even if that requires going through the Federation first, it's probably a very good strategic choice nevertheless, compared with crossing the border somewhere farther away. The Feds aren't so uptight about who sails through their space, especially under cloak.
Many wars in the Trek universe probably take place across considerable distances of neutral or third-party territory. Why annoy your neighbors if your aim is just to pillage, or to destroy potential future adversaries? Klingons supposedly sent a fleet against the Breen in the past, just for the heck of it; we've never heard of border squabbles between the Klingon Empire and the Breen Confederacy.
The Feds would be an exception to this, fighting only their neighbors, and only for defensive reasons. Then again, the Feds may well choose to expand by annexing very distant cultures, creating isolated patches of territory they have to defend, with neutral/third-party space in between. No aggressor empire would be likely to expand in such a foolish manner...
The bottom line being, unless we have an explicit reference to a border between A and B, we should not deduce that such a border exists merely because A and B interact.