Electronic states bound to impurities located in the quantum well barriers are calculated when the bulk binding energy is comparable to the quantum well depth. We show the existence of a complex level pattern due to the interaction between barrierlike states and states which are essentially confined in the well. The effects of an electric field are also discussed.