This paper proposes a safety-critical controller for dynamic and uncertain environments, leveraging a robust environment control barrier function (ECBF) to enhance the robustness against the measurement and prediction uncertainties associated with moving obstacles. The approach reduces conservatism, compared with a worst-case uncertainty approach, by incorporating a state observer for obstacles into the ECBF design. The controller, which guarantees safety, is achieved through solving a quadratic programming problem. The proposed method's effectiveness is demonstrated via a dynamic obstacle-avoidance problem for an autonomous vehicle, including comparisons with established baseline approaches.