Aims. The comparative study of several molecular species at the origin of the gas phase chemistry in the diffuse interstellar medium (ISM) is a key input in unraveling the coupled chemical and dynamical evolution of the ISM. Methods. The lowest rotational lines of HCO+, HCN, HNC, and CN were observed at the IRAM-30m telescope in absorption against the lambda 3 mm and lambda 1.3 mm continuum emission of massive star-forming regions in the Galactic plane. The absorption lines probe the gas over kiloparsecs along these lines of sight. The excitation temperatures of HCO+ are inferred from the comparison of the absorptions in the two lowest transitions. The spectra of all molecular species on the same line of sight are decomposed into Gaussian velocity components. Most appear in all the spectra of a given line of sight. For each component, we derived the central opacity, the velocity dispersion, and computed the molecular column density. We compared our results to the predictions of UV-dominated chemical models of photodissociation regions (PDR models) and to those of non-equilibrium models in which the chemistry is driven by the dissipation of turbulent energy (TDR models). Results. The molecular column densities of all the velocity components span up to two orders of magnitude. Those of CN, HCN, and HNC are linearly correlated with each other with mean ratios N(HCN)/N(HNC) = 4.8 $pm$ 1.3 and N(CN)/N(HNC) = 34 $pm$ 12, and more loosely correlated with those of HCO+, N(HNC)/N(HCO+) = 0.5 $pm$ 0.3, N(HCN)/N(HCO+) = 1.9 $pm$ 0.9, and N(CN)/N(HCO+) = 18 $pm$ 9. These ratios are similar to those inferred from observations of high Galactic latitude lines of sight, suggesting that the gas sampled by absorption lines in the Galactic plane has the same chemical properties as that in the Solar neighbourhood. The FWHM of the Gaussian velocity components span the range 0.3 to 3 km s-1 and those of the HCO+ lines are found to be 30% broader than those of CN-bearing molecules. The PDR models fail to reproduce simultaneously the observed abundances of the CN-bearing species and HCO+, even for high-density material (100 cm-3 < nH < 104 cm-3). The TDR models, in turn, are able to reproduce the observed abundances and abundance ratios of all the analysed molecules for the moderate gas densities (30 cm-3 < nH < 200 cm-3) and the turbulent energy observed in the diffuse interstellar medium. Conclusions. Intermittent turbulent dissipation appears to be a promising driver of the gas phase chemistry of the diffuse and translucent gas throughout the Galaxy. The details of the dissipation mechanisms still need to be investigated.