Find subgraphs that can only be reached by two nodes
I don't know if there's a name for such subgraphs, but here's something to get you started.
If you require the subgraphs to be connected
A polytime algorithm for $G=(V,E)$ would be: for every possible unordered pair $(A,F)\in \binom{V}{2}$ consider the connected components of the graph induced by $V\smallsetminus\{A,F\}$. Then consider the classes which contain at least a neighbour of $A$ and one of $F$ (this step is required if the original graph was not connected). Then for each subgraph you found you can &quot;add $A$ and $F$ back in&quot; and look for their distance in the graph.
Let's sketch correctness (only the step about the subgraphs we are looking for being the connected components needs to be verified).

All components are solutions: by construction they only share links with themselves and A and F, and are connected.
All solutions are components: they are connected and only connect to the rest of the graph through A and F.

I am guessing you can do much better in runtime, but your problem seems to be in $P$ at least.
If you don't
You need to also consider combinations of the subgraphs found above, but in terms of the minimum distance it doesn't change much.