All disc-accreting astrophysical objects produce powerful disc winds. In compact binaries containing neutron stars or black holes, accretion often takes place during violent outbursts. The main disc wind signatures during these eruptions are blue-shifted X-ray absorption lines, which are preferentially seen in disc-dominated `soft states'1,2. By contrast, optical wind-formed lines have recently been detected in `hard states', when a hot corona dominates the luminosity3. The relationship between these signatures is unknown, and no erupting system has as yet revealed wind-formed lines between the X-ray and optical bands, despite the many strong resonance transitions in this ultraviolet (UV) region4. Here we report that the transient neutron star binary Swift J1858.6-0814 exhibits wind-formed, blue-shifted absorption lines associated with C IV, N V and He II in time-resolved UV spectroscopy during a luminous hard state, which we interpret as a warm, moderately ionized outflow component in this state. Simultaneously observed optical lines also display transient blue-shifted absorption. Decomposing the UV data into constant and variable components, the blue-shifted absorption is associated with the former. This implies that the outflow is not associated with the luminous flares in the data. The joint presence of UV and optical wind features reveals a multi-phase and/or spatially stratified evaporative outflow from the outer disc5. This type of persistent mass loss across all accretion states has been predicted by radiation-hydrodynamic simulations6 and helps to explain the shorter-than-expected duration of outbursts7.