Rydberg-atom-based controlled arbitrary-phase gate and its applications