I hope I can word this correctly, but I am looking for instances when two countries nearly border one another but are separated by a narrow land belonging to another country. In other words near misses when it comes to neighborliness ruined by a third country.
To my surprise I could not find any authoritative sources, only a forum from 2004 in which one answer was Pakistan and Tajikistan. These two are separated by a narrow strip of Afghan territory. I suspect this is the answer just by glancing at a world atlas, but can’t be sure. Wikipedia has articles on geographic facts such as nations that border one or four other nations, landlocked, etc. But not this.
Google does not lead to any source. I know Kazakhstan and Mongolia are nearly neighbors also, but not as close as the former example.
Botswana and Angola are separated by a skinny spit of Namibia, just 33km or so across according to the Google Maps measurement function. Your Pakistan/Tajikistan example looks to be more like 20km. The closest example in the Americas that I can see is Belize/Honduras separated by Honduras by 65km or so.
Israel and Saudi Arabia are separated by a small stretch of Jordan. Monaco and Italy are walking distance from one another; you’d be walking through France.
Thailand and Vietnam were it not for Laos.
Myanmar and Vietnam were it not for narrow stubs of both Laos and China.
India and Myanmar actually touch despite having Bhutan and Bangladesh between them.
Togo keeps Ghana from touching Benin. Both Togo and Benin keep Ghana from touching both Nigeria and Niger.
Trade relations between Thailand and Vietnam are growing, and the two are increasingly referred to as neighbors. They’re separated by Laos or Cambodia, depending on which direction you go. Cambodia is kind of chunky, but Laos probably qualifies as a narrow strip.
EDIT: And I see now this has been mentioned a couple of times already. Oh well, make it a hat trick.
If you want to count US states, Maryland and New Jersey are separated by about 15 miles of Delaware and Maine and Vermont miss each other by about 20 miles.
On the national level, Ghana and Benin are separated by about 28 miles of Togo.
Croatia and Austria would be neighbors if not for the 15 miles of Slovenia between them.
Liechtenstein is between Austria and Switzerland, but they’re both big enough to have plenty of contact points either side; likewise, Andorra, France and Spain. On a rather larger scale, the Limburg province of the Netherlands protrudes southerly between Belgium and Germany, and you could say Luxembourg does the same job for Belgium, France and Germany further south.
I don’t quite see the point of the OP’s “near misses when it comes to neighborliness ruined by a third country”.
The Kingdom of Navarre ( earlier Pamplona ) separated Castile and France — and with Bearn, bordered Aragon — until the lower part was taken by Spain and the north subsumed into the French Crown along with Henri IV.
Of course France is composed of many formerly independent parts, more arbitrarily than most in point of the recentness of their independence. It would be amusing had Navarre, say conquered Guyenne and perhaps the Languedoc; and just merged with Brittany through marriage, forming a nation controlling most of France’s coast.