The origin of ultra-high-energy cosmic rays (UHECRs) remains debated. The prompt and afterglow phases of low-luminosity gamma-ray bursts (LLGRBs) are seen as promising candidates for this acceleration. Here, we investigate this connection by looking at the unavoidable emission from the electrons that are co-accelerated together with UHECRs. Specifically, we use the data from the archetypical low-luminosity GRB 060218. We find that if acceleration of UHECRs occurred during the prompt phase, the emission from the electrons would be orders of magnitude brighter than the observations in the optical band. For the afterglow phase, we limit the total available kinetic energy by comparing the emission from the thermal electrons to the radio data at three days. We find that the total energy in the afterglow is not sufficient to supply the UHECR flux observed at Earth. These results challenge the mildly relativistic outflows of LLGRBs as the main sources of UHECRs.