UWB ranging measurements are prone to positive bias errors in NLOS conditions. Existing algorithms often use a uniform model to correct various ranging measurement errors, which has poor performance and fails to fully utilize the advantages of UWB technology. This article proposes a credibility evaluation system for assessing the quality of ranging measurement and the error fine-grained classification. For different sources of ranging measurement errors, we develop optimization models that integrate BERT with LSTM, focusing on both temporal and energy information, and extending the correction range to LOS measurements. In multi-scenario experiments, the credibility evaluation error was 0.047, with LOS and NLOS ranging measurement errors reduced by 37.9% and 80.94%, respectively. This approach outperforms LS-SVM, CNN, and CNN-LSTM by 57.21%, 43.2%, and 18.99%. After optimization, centimeter-level positioning accuracy improved by 30.2%, and the average error was reduced by 69.68%, surpassing advanced algorithms by 42.53%, 43.61%, and 44.00%.