Uniform invariant subspace perturbation theory and applications