I'm pretty sure, logically, that both the Engineer AND the Operative will get XP from the turret while the Op is controlling it.
As for range, you have to be able to aim at the turret when you're taking control - so you'll probably need line of sight at the very least... if enemies notice erratic behaviour or a wider tracking arc, they can get to the turret's location and use the position of the turret to work out where you are.
Or they could just shoot at the turret. When you take control of it, it can't automatically aim at enemies - you introduce human error. A few well-placed bursts of lead from behind various bits of cover, and you'll do more damage and surive longer than if it was a real turret.
Then again, if the Op releases control of the turret and you pop out for a few more shots,
you're going to be the one pumped full of lead.