Roadside LiDAR has become an important sensor for the detection of objects in cities, such as vehicles and pedestrians, which is due to its advantages of all-weather operation and high-ranging accuracy. In order to serve an intelligent transportation system, the efficient and accurate segmentation of vehicles and pedestrians is needed in the coverage area of the LiDAR. In this study, a roadside LiDAR was fixed on brackets on both sides of the road to obtain the point-cloud information on the urban road and the surrounding environment. A segmentation method that is based on a scanning LiDAR sensor is proposed. First, a polar grid that is based on polar coordinates is constructed to count the LiDAR rotations to obtain the original information of the angle and the distance of the point cloud, and the background point-cloud image is dynamically updated over time. By aiming at the complex urban road environment and the interference of trees and light poles in the background, an adaptive polar-grid Gaussian-mixture model (APG-GMM) that uses a point-cloud method is proposed to improve the accuracy of the foreground and background segmentation. A density-adaptive DBSCAN target-clustering algorithm is proposed, as well as a dynamic adaptive neighborhood radius, to solve the problem of the low clustering accuracy that is caused by the uneven density of point clouds that are collected by LiDAR, and to divide the point clouds in the foreground into vehicles and pedestrians. Finally, the method was tested at intersections and urban roads with dense traffic flows. The experimental results show that the proposed algorithm can segment the foreground and background well and can cluster vehicles and pedestrians while reducing the number of calculations and the time complexity.