In an engine failure, should I expect less range than with the engine in idle?
Yes to some degree.  It depends on the idle rpm, prop pitch, engine compression and your gliding speed, but if the engine is off but windmilling, there is substantial drag from the energy needed to windmill the prop without any help from the engine and it will knock some measurable amount off the glide ratio.  

When it's idling, it might still be windmilling a bit if there is still a negative angle of attack on the blades.  At some rpm just above idle, the prop's rotation speed will be at the zero thrust point (blade AOA at zero) and the glide will be like there is no prop there at all. To know where that is, you'd have to be able to measure the thrust load directly somehow.  So it's quite a moving target, trying to come up with a gliding value with different conditions with a running engine.

With the engine off completely, the windmilling drag drag case is at its worst, and the best glide is achieved if the propeller can be stopped completely so that the blade is fully stalled with a near 90 deg AOA, but this is not something advocated in training.  

A stationary fixed pitch propeller makes way less drag that one being driven around by airflow, which is effectively in an "autorotation" making substantial lift aft. You an visualize this by imagining an autogyro, which can descend vertically with the airflow going straight up through its rotor to drive it - it's windmilling - and the rotor creates enough lift to limit the gyro's descent rate to about 500 fpm. Make the rotor stop completely and the autogyro becomes a falling anvil.   Turn the gyro 90 degrees, make the rotor really small, like propeller size, and there's your gliding 172. 

Problem is, while it's theoretically beneficial to get the prop to stop, you usually have to slow down quite a lot, maybe close to stall speed, not a good idea at low altitude. And a tired engine with low compression might keep windmilling right down to the stall speed (and an engine with tight cylinders may stop windmilling right at glide speed - a nice bonus).  Under a few thousand feet, there are too many risks and other priorities to bother with this just for the L/D improvement.

If the engine quit at a substantial altitude and glide distance was absolutely critical (like over the water and trying to make it back to shore), I might try slowing it down to get the prop to stop windmilling. How slow I have to go to get it to stop, and how fast I can go before it starts windmilling again depends on the cylinder compression in the engine, so it may work well or it may not, and I may have used up most of the benefit trying to get the thing to stop.  

As a student pilot, don't go there on your own (thinking about slowing down to stop the prop) but it wouldn't hurt at all to ask for a demonstration at altitude to observe the glide performance with the prop windmilling vs stopped vs idling.  You'd get some sense of the drag differences by noting the descent rate at the same airspeed for each case.

The above applies to fixed pitch propellers.  If you have a constant speed prop (variable pitch, non feathering, and if it's feathering, like on a turboprop, well it's not an issue at all), it gets more nuanced.  Normally if the engine quits the prop goes to full fine pitch with the blades nearly flat and it likely will stop windmilling at gliding speed.  Some people argue that moving the prop control to full coarse (low RPM) before the oil pressure decays can get the blades to kind of "part way to feather" and this will reduce the drag of the prop to less than a stationary prop at full fine with the blades nearly flat.  On the other hand, the coarse pitch might just get it windmilling... Hard to say without some testing.