Ultra-wideband (UWB) is a key technology that enables the evolution of localization systems and makes it possible to provide more and better location-based services. However, the accuracy of the localization system decreases when the localization devices are worn by human beings, because in some conditions they obstruct the line of sight (LOS) between the transmitter and the receiver terminal. The interaction between the human being and the terminal, and its effects on the performance of indoor localization systems, is an open problem that is being tackled by researchers from analytical and empirical perspectives. In this research, we are considering an empirical approach based on the use of machine learning (ML) models. ML models are used to classify the channel condition (LOS and non-LOS), ruling out non-LOS paths and only using the information coming from the classified LOS paths to estimate the mobile terminal's location. The work compares different combinations of empirical statistical measures and ML models, including the support vector machine (SVM), decision tree (DT), long short-term memory (LSTM), and k-means models, achieving a path classification accuracy of up to 83%, and localization positioning errors lower than 30 cm in 90% of cases. The results indicate that supervised learning techniques, including SVM, DT, and LSTM, achieve higher accuracy but require longer training times. In contrast, unsupervised learning techniques provide sufficient accuracy for most applications, requiring less training time, and allowing faster response. The accuracy of the UWB localization system improves the 90th percentile position errors from 71 to 27 cm without previously classifying the LOS/non-line of sight (NLOS) paths and after removing NLOS paths. For the unsupervised learning model, the accuracy improves from 71 to 41 cm for the same percentile.