You need both for two reasons :
1- HID lights draw a considerable amount of electricity during the ignition of the bulbs so a relay wiring harness is recommended ,otherwise, there is a possibility of burning the stock wires overtime and/or create more issues.
2-The flickering issue is simple to explain... Each HID ballast need a constant 12/13VDC voltage to function properly and any variation in the voltage will make the lights to flick. Some peoples use huge capacitors for each ballast ...
The easiest way is with a relay wring harness , that way the power is directly provided by the battery to the ballasts and it's one of your stock headlamp plug that turn on or off the relay.
Again , if the relay do not have a constant 12 VDC , the relay will open and close very fast causing flickering on both lights .. so only one capacitor on the relay solve all problem