Abstract: In this paper, the control algorithm for longitudinal control of a passenger car that is moving on the highway and urban traffic is provided. Longitudinal dynamic equation including resisting forces acting on the vehicle presented and structural and non-structural uncertainties in the model are investigated. To control the speed of vehicles on the highway and vehicle distance control in city traffic, vehicle longitudinal control laws have been proposed. To control the speed of vehicles on the highway and in city traffic, vehicle longitudinal control laws have been proposed. In order to control the nonlinear systems, the sliding mode method which is a robust control method has been used for the design controller. The controller consists of two algorithms as speed control and distance control that their duty is done with the force generation to move the vehicle and overcome the disturbances and uncertainties using tracing of it by car. Finally, to ensure the ability of control and efficiency under different conditions, the control rules are applied to the vehicle dynamics equation.