Localization based on single-line lidar is widely used in various robotics applications, such as warehousing, service, transit, and construction, due to its high accuracy, cost-effectiveness, and minimal computational requirements. However, challenges such as LiDAR degeneration and frequent map changes persist in hindering its broader adoption. To address these challenges, we introduce the Contribution Sampling and Map-Updating Localization (CSMUL) algorithm, which incorporates weighted contribution sampling and dynamic map-updating methods for robustness enhancement. The weighted contribution sampling method assigns weights to each map point based on the constraints within degenerate environments, significantly improving localization robustness under such conditions. Concurrently, the algorithm detects and updates anomalies in the map in real time, addressing issues related to localization drift and failure when the map changes. The experimental results from real-world deployments demonstrate that our CSMUL algorithm achieves enhanced robustness and superior accuracy in both degenerate scenarios and dynamic map conditions. Additionally, it facilitates real-time map adjustments and ensures continuous positioning, catering to the needs of dynamic environments.