The interaction of ultra-high-energy cosmic rays (UHECRs) with pervasive photon fields generates associated cosmogenic fluxes of neutrinos and photons due to photohadronic and photonuclear processes taking place in the intergalactic medium. We perform a fit of the UHECR spectrum and composition measured by the Pierre Auger Observatory for four source emissivity scenarios: power-law redshift dependence with one free parameter, active galactic nuclei, gamma-ray bursts, and star formation history. We show that negative source emissivity evolution is favoured if we treat the source evolution as a free parameter. In all cases, the best fit is obtained for relatively hard spectral indices and low maximal rigidities, for compositions at injection dominated by intermediate nuclei (nitrogen and silicon groups). In light of these results, we calculate the associated fluxes of neutrinos and photons. Finally, we discuss the prospects for the future generation of high-energy neutrino and gamma-ray observatories to constrain the sources of UHECRs.