The dynamical evolution of bodies under the gravitational influence of the accreting proto-Uranus and proto-Neptune is investigated. The main aim of this study is to analyze the interrelations between the accretion of Uranus and Neptune with other processes of cosmological importance as, for example, the formation of a cometary reservoir from bodies placed into near-parabolic orbits by planetary perturbations and the scattering of bodies to the region of the terrestrial planets. Starting with a mass ratio (initial mass/present mass) of 0.1, Uranus and Neptune acquire masses close to their present ones in a time scale of 108 years. Neptune is found to be the most important contributor of comets to the cometary reservoir. The time scale of bodies scattered by Neptune to reach near-parabolic orbits (semimajor axes a > 104 AU)is about 109 years. The contribution of Uranus was partially inhibited because a large part of the residual bodies of its accretion zone fell under the strong gravitational influence of Jupiter and Saturn. A significant fraction of the bodies dispersed by Uranus and Neptune reached the region of the terrestrial planets in a time scale of some 108 years.