The formula you have given in the question is used for finding image position due to refraction at spherical surfaces.
The mirrors work on the principle of reflection and there is no way you could adjust that formula to work with mirrors. In fact, the refractive index(s) in the formula make no sense for a mirror.
Secondly, most of the proofs in Optics are geometrical proofs where we use the distance between one point and another. After deriving the equation, we apply the sign convention so that anyone using the formula can directly substitute values as per convention.
For example, in our geometric derivations, we use $|u|$ as the distance of the object from the mirror/lens. If the object was behind the mirror, u is negative, so substituting $u$ with the sign in our formula would yield a wrong answer. Hence, we apply the sign convention to the formula once so that in future, the values can be substituted with signs. So if $u = -20$, the $-u$ will change it to 20 which is what the geometric formula expects (it needs distances).
From the comments:
So does that mean, in this equation, where we have used the
conventions in derivation, we won’t put =-20. when we’re solving a
— Aaryan Dewan
Its the other way round. When we prove a formula, we assume the
variables to be distances so if you have to solve a problem using the
formula, you will have to substitute distances every time which will
complicate the process when you have virtual object or image, etc. So
after deriving the formula, we apply the sign convention rules once so
that one can substitute values as per the sign convention. If you
apply sign convention rules twice, you will get back the original
distance based formula.