For completeness I will write the comments here, to close the question.
Given $f\in C^\infty(M)$, in relation to the given stratum $\mathcal{F}^1$ it might be hard to measure distance because we want to detect when the function has precisely one birth point or has precisely one pair of critical points with identical values (the strata is explained nicely in Hatcher-Wagoner's book on the subject). But if we ignore this "precisely one birth or pair" condition (by perturbing from higher codimension strata), then
the distance can be $f\mapsto \min_{p\in crit(f)}|\det(Hess(f,p))|\cdot\inf_{p\ne q\in crit(f)}|f(p)-f(q)|$
Here the first factor checks for birth points, and the second factor checks for distinct critical points with identical values. If we further want to consider the stratum which doesn't contain Morse functions (so that we only worry how far away $f$ is from giving birth to / killing a critical point), then we can drop the second factor.