The indoor positioning technology based on ultra-wideband (UWB) has made significant progress. However, the accuracy of UWB's range information is susceptible to errors in both line-of-sight and non-line-of-sight conditions, which hinders precise positioning. To address this issue, this paper proposes an improved particle filter algorithm for target localization. Specifically, the importance function of the fundamental particle filter is enhanced by constructing the importance probability density function using the Kalman filter technique, which mitigates the problem of particle degeneracy and makes the particle distribution more similar to the posterior probability distribution. Additionally, a genetic algorithm is employed to enhance the resampling method, which increases particle diversity and reduces particle depletion. These improvements significantly enhance the accuracy and precision of UWB-based indoor positioning technology. Simulation results demonstrate that the proposed algorithm can effectively improve the positioning accuracy in both line-of-sight and non-line-of-sight environments.