The X-ray and ultraviolet absorbing outflow in 3C 351