When I want to express the idea of "someone is ever so close to / inches away from / a step away from doing something", I usually say « à deux doigts de faire quelque chose ». A similar expression « à deux pas de » seems to be reserved solely for denoting spatial proximity, as in:
« à deux pas de chez toi »
I find it interesting that in French, you use the word "doigt(finger)" instead of "pas(step)" for the figurative meaning of "a step away from", whereas the equivalent idiomatic expressions in English, German, Italian, Russian and Polish all revolve round the word "pas(step)" – "a step away from", "einen Schritt davon entfernt", "a un passo dal", "в шаге от" and "tylko o krok od" respectively.
This is why I was wondering if you could ever say:
« à deux pas de faire quelque chose »
in French as well.