Three critical points for perturbed nonsmooth functionals and applications