Sure it can work. I run more than 6 feet. You need to do a couple of things to maximize you chances.
First, run shielded cable and ground the cable at you electronics enclosure end rather than at the machine.
Second, since you're running HEDS encoders, be sure to add the bypass capacitors Mariss F. has recommended.
I'm not having any problems since having done those two things.
For more on the bypass caps for HEDS, go to this page:
and search for HEDS.