CO is an important component of a protoplanetary disc as it is one of the most abundant gas phase species. Furthermore, observations of CO transitions can be used as a diagnostic of the gas, tracing conditions in both the inner and outer disc. We present Herschel/PACS spectroscopy of a sample of 22 Herbig Ae/Be (HAEBEs) and eight T Tauri stars (TTS), covering the pure rotational CO transitions from J = 14 → 13 up to J = 49 → 48. CO is detected in only five HAEBEs, namely AB Aur, HD 36112, HD 97048, HD 100546, and IRS 48, and in four TTS, namely AS 205, S CrA, RU Lup, and DG Tau. The highest transition detected is J = 36 → 35 with E up of 3669 K, seen in HD 100546 and DG Tau. We construct rotational diagrams for the discs with at least three CO detections to derive T rot and find average temperatures of 270 K for the HAEBEs and 485 K for the TTS. The HD 100546 star requires an extra temperature component at T rot ∼ 900-1000 K, suggesting a range of temperatures in its disc atmosphere, which is consistent with thermo-chemical disc models. In HAEBEs, the objects with CO detections all have flared discs in which the gas and dust are thermally decoupled. We use a small model grid to analyse our observations and find that an increased amount of flaring means higher line flux, as it increases the mass in warm gas. CO is not detected in our flat discs as the emission is below the detection limit. We find that HAEBE sources with CO detections have high L UV and strong PAH emission, which is again connected to the heating of the gas. In TTS, the objects with CO detections are all sources with evidence of a disc wind or outflow. For both groups of objects, sources with CO detections generally have high UV luminosity (either stellar in HAEBEs or due to accretion in TTS), but this is not a sufficient condition for the detection of the far-IR CO lines.