The charge density wave in the high-temperature superconductor YBa2Cu3O7−x (YBCO) has two different ordering tendencies differentiated by their c-axis correlations. These correspond to ferro- (F-CDW) and antiferro- (AF-CDW) couplings between CDWs in neighbouring CuO2 bilayers. This discovery has prompted several fundamental questions: how does superconductivity adjust to two competing orders and are either of these orders responsible for the electronic reconstruction? Here we use x-ray diffraction to study YBa2Cu3O6.67 as a function of magnetic field and temperature. We show that regions with F-CDW correlations suppress superconductivity more strongly than those with AF-CDW correlations. This implies that an inhomogeneous superconducting state exists, in which some regions show a fragile form of superconductivity. By comparison of F-CDW and AF-CDW correlation lengths, it is concluded that F-CDW ordering is sufficiently long-range to modify the electronic structure. Our study thus suggests that F-CDW correlations impact both the superconducting and normal state properties of YBCO.