The ability to correctly localize sounds is important for general awareness of the auditory scene and communication in adverse acoustic conditions. However, most localization studies are performed in rather simple and artificial conditions. In particular, very few studies have considered localization in reverberant environments or in the presence of complex interferers, and no studies have systematically investigated the effect of distance. In the present study, localization performance was measured as a function of both source-receiver distance and signal-to-noise ratio (SNR) using a virtual auditory environment. With increasing source-receiver distance the direct-to-reverberation energy ratio decreases and the auditory system increasingly relies on mechanisms related to the precedence effect (PE). Both aspects may be particularly problematic for hearing-impaired listeners. The acoustics of a cafeteria were simulated with the ODEON software for a large number of target sources located in the horizontal plane at 1, 2, and 4 m distance to the listener. Signals were generated for a 3D array of 41 loudspeakers using the loudspeaker-based room auralization (LoRA) toolbox. Localization performance for the target word “two” was measured in eight normal-hearing (NH) and eleven hearing-impaired (HI) listeners with a moderate symmetric hearing loss in the simulated cafeteria with and without a multi-talker speech background. In order to minimize the influence of audibility, in-dividual masked thresholds (MTs) were first measured for the target word in the multi-talker background using an adaptive tracking procedure. The SNRs used in the localization experiment were then adjusted relative to the individual MTs. For the HI subjects the localization performance showed a very large inter-subject variation. This variation could not be explained by the audio-grams, except that the very poor performers tended to have slightly worse hearing at low frequencies. Localization performance in quiet was found to be independent of distance for the NH subjects but for most HI listeners deteriorated with increasing distance. This suggests that the PE helps localization in realistic environments but is less effective in HI listeners. In the presence of background noise all NH and HI subjects showed a significant decrease in localization performance. Additionally the NH listeners now also showed a significant distance effect, which is in line with the observation that the PE is weakened in background noise. The present study highlights the importance of considering more realistic scenarios in hearing research and may serve as a basis for developing spatial hearing tests with improved ecological validity.