Vyxal, 1314 bytes
K'2lv∑⁰vca¬;tK'2lv∑⁰vca¬;tL
A bit messy.
K # Substrings
' ; # Filtered by...
a¬ # None of...
2lv∑ # Substrings of length 2
vc # Are contained in...
⁰ # The second input
t # Get the last (and longest) element
# This works because K returns the elements in order of shortest to longest
L # And filtering out elements can'tGet unsortits itlength