Welcome to EP.
Yes, no problem at all.
You did say 6",did you mean 6' ?
That is fine as well .
Not clear if the wire is on the 120Vac or the 5VDC.
Current-wise there is no problem with both voltages.
But,take care to use a well isolated wire-pair on the 120V.