But i would insulate them.
See also: related tab >>>>>>https://www.instructables.com/id/Make-A-Guitar-Pickup/https://www.instructables.com/id/cheap-and-easy-guitar-pickups/https://www.instructables.com/id/Acoustic-Guitar-Pickup/
They can touch, but they should be electrically insulated from each other (the wire should be insulated anyway).
Long and short: The moving string thru the magnetic field induces an electric/magnetic current in the string, which induces a current in the coil, so they just need to be close to one another.
Specific distances are important for specific tones - but 'make sound with coil' just needs a magnet, a conductive wire, and a coil.