A search for dark matter is conducted in final states containing a photon and missing transverse momentum in proton-proton collisions at root s = 13 TeV. The data, collected during 2015-2018 by the ATLAS experiment at the CERN LHC, correspond to an integrated luminosity of 139 fb(-1). No deviations from the predictions of the Standard Model are observed and 95% confidence-level upper limits between 2.45 fb and 0.5 fb are set on the visible cross section for contributions from physics beyond the Standard Model, in different ranges of the missing transverse momentum. The results are interpreted as 95% confidence-level limits in models where weakly interacting dark-matter candidates are pair-produced via an s-channel axial-vector or vector mediator. Dark-matter candidates with masses up to 415 (580) GeV are excluded for axial-vector (vector) mediators, while the maximum excluded mass of the mediator is 1460 (1470) GeV. In addition, the results are expressed in terms of 95% confidence-level limits on the parameters of a model with an axion-like particle produced in association with a photon, and are used to constrain the coupling g(aZ gamma) of an axion-like particle to the electroweak gauge bosons.