Cuprate materials hosting high-temperature superconductivity (HTS) also exhibit various forms of charge and spin ordering whose significance is not fully understood. So far, static charge-density waves (CDWs) have been detected by diffraction probes only at particular doping levels or in an applied external field . However, dynamic CDWs may also be present more broadly and their detection, characterization and relationship with HTS remain open problems. Here we present a method based on ultrafast spectroscopy to detect the presence and measure the lifetimes of CDW fluctuations in cuprates. In an underdoped La(1.9)Sr(0.1)CuO4 film (T(c) = 26 K), we observe collective excitations of CDW that persist up to 100 K. This dynamic CDW fluctuates with a characteristic lifetime of 2 ps at T = 5 K that decreases to 0.5 ps at T = 100 K. In contrast, in an optimally doped La(1.84)Sr(0.16)CuO4 film (T(c) = 38.5 K), we detect no signatures of fluctuating CDWs at any temperature, favouring the competition scenario. This work forges a path for studying fluctuating order parameters in various superconductors and other materials.