We report constraints on the sources of ultra-high-energy cosmic ray (UHECR) above $10^{9}$ GeV, based on an analysis of seven years of IceCube data. This analysis efficiently selects very high energy neutrino-induced events which have deposited energies from $sim 10^6$ GeV to above $10^{11}$ GeV. Two neutrino-induced events with an estimated deposited energy of $(2.6 pm 0.3) times 10^6$ GeV, the highest neutrino energies observed so far, and $(7.7 pm 2.0) times 10^5$ GeV were detected. The atmospheric background-only hypothesis of detecting these events is rejected at 3.6$sigma$. The hypothesis that the observed events are of cosmogenic origin is also rejected at $>$99% CL because of the limited deposited energy and the non-observation of events at higher energy, while their observation is consistent with an astrophysical origin. Our limits on cosmogenic neutrino fluxes disfavor the UHECR sources having cosmological evolution stronger than the star formation rate, e.g., active galactic nuclei and $gamma$-ray bursts, assuming proton-dominated UHECRs. Constraints on UHECR sources including mixed and heavy UHECR compositions are obtained for models of neutrino production within UHECR sources. Our limit disfavors a significant part of parameter space for active galactic nuclei and new-born pulsar models.