For USB 2.0 High Speed (480Mbit/s), yes, it should work fine.
Many PC motherboards used to have 2×5-pin headers (bog standard 0.1" spacing) for a pair of USB 2.0 connectors to be mounted on the front, with a twisted pair for D+/D-, each, and straight wires for the common USB 5V and GND, for a total of 6 conductors. Mine were about 300mm/12" long, and I had no problems.
(I'm assuming the environment inside the enclosure is not so noisy, electromagnetically speaking, that the microcontroller needs a shielding can or anything like that.)