Improving the Resilience of Barrier Function-Based Safety-Critical Controllers Against Uncertainties with Application to Connected Autonomous Vehicles