Stability results for two classes of nonlinear unilateral problems