Unified Path Planner with Adaptive Safety and Optimality