Prox-regular sets and applications