The observation of WWγ production in proton-proton collisions at a center-of-mass energy of 13 TeV with an integrated luminosity of 138 fb^{-1} is presented. The observed (expected) significance is 5.6 (5.1) standard deviations. Events are selected by requiring exactly two leptons (one electron and one muon) of opposite charge, moderate missing transverse momentum, and a photon. The measured fiducial cross section for WWγ is 5.9±0.8(stat)±0.8(syst)±0.7(modeling) fb, in agreement with the next-to-leading order quantum chromodynamics prediction. The analysis is extended with a search for the associated production of the Higgs boson and a photon, which is generated by a coupling of the Higgs boson to light quarks. The result is used to constrain the Higgs boson couplings to light quarks.