LiDAR technology has garnered significant attention in recent years due to its superior directivity, high resolution, and precise 3D information acquisition capabilities, making it indispensable in navigation systems. Among its variants, single-photon LiDAR stands out for maritime applications, owing to its reduced power consumption and extended detection range. However, the high sensitivity of single-photon detectors often results in substantial noise, necessitating effective denoising before data can be utilized for identification, tracking, and other purposes. In this study, we present a novel 128-line, 1550 nm shipborne long-range single-photon LiDAR system, with data collected and analyzed in maritime environments. This system contends with challenges such as a large dynamic range, abundant noise photons, and the complexity of sea surface conditions. To address these issues, we propose an efficient and adaptive denoising algorithm based on the k-th nearest neighbor (KNN) methodology. By examining the distribution characteristics of signal and noise photons, our approach enables target extraction even under conditions of intense noise and sparse signals. Our method exhibits robust adaptability across various detection scenarios. Experimental evaluations demonstrate its efficacy, accurately identifying targets at distances of 3.2 km in clear weather and 1.6 km in foggy conditions.