We consider the problem of ranging with impulse radio (IR) ultra-wideband (UWB) radio under dense multipaths propagation environments and additive Gaussian noise. We propose a Bayesian detection algorithm where the prior distribution of the channel follows the IEEE 802.15.4a channel model, to identify whether the received signal is a Line-of-Sight (LOS) signal or a Non-Line-of-Sight (NLOS) signal. If it is a LOS signal, we use a Bayesian estimation approach to estimate the joint posterior probability density function (pdf) of the channel and the targeted distance. One of applications of the joint posterior pdf of the channel and the targeted distance is the ranging determination with classical posterior estimators (such as Minimum Mean Square Error Estimator (MMSE)). For computing the joint posterior pdf of the channel and the targeted distance, we derived a novel algorithm which is based on importance sampling and expectation maximum techniques. Numerical evaluations under the IEEE 802.15.4a channel model are presented to demonstrate the good performance of the proposed algorithms.