Purpose Accurate mapping is crucial for the positioning and navigation of mobile robots. Recent advancements in algorithms and the accuracy of LiDAR sensors have led to a gradual improvement in map quality. However, challenges such as lag in closing loops and vignetting at map boundaries persist due to the discrete and sparse nature of raster map data. The purpose of this study is to reduce the error of map construction and improve the timeliness of closed loop. Design/methodology/approach In this letter, the authors introduce a method for dynamically adjusting point cloud distance constraints to optimize data association (ODA-d), effectively addressing these issues. The authors propose a dynamic threshold optimization method for matching point clouds to submaps during scan matching. Findings Large deviations in LiDAR sensor point cloud data, when incorporated into the submap, can result in irreparable errors in correlation matching and loop closure optimization. By implementing a data association framework with double constraints and dynamically adjusting the matching threshold, the authors significantly enhance submap quality. In addition, the authors introduce a dynamic fusion method that accounts for both submap size and the distance between submaps during the mapping process. ODA-d reduces errors between submaps and facilitates timely loop closure optimization. Originality/value The authors validate the localization accuracy of ODA-d by examining translation and rotation errors across three open data sets. Moreover, the authors compare the quality of map construction in a real-world environment, demonstrating the effectiveness of ODA-d.