Urban forests and parks are essential for the maintenance of biodiversity as well as human health and well-being. Residents and tourists commonly use urban forests and parks for recreational and sport purposes, contributing to changes in vegetation. This study aimed to assess the effect of distance from formal paths on the abiotic conditions, vegetation cover, as well as ecological diversity of vascular plant species in the undergrowth of urban forests and parks. The investigations were carried out in 2021 in 10 urban forests and 10 urban parks located in Kraków (southern Poland), using a total of 400 plots (1 × 1 m) situated in close (CL) and further (FU) vicinity of formal paths. We found a positive effect of the distance from the path on the depth of the compact soil layer, vegetation cover and height of the tallest shoot in the undergrowth of urban forests and parks. On the other hand, the distance from the path had a negative effect on the number of vascular plant species in the undergrowth in both forests and parks. Forests and parks differed significantly from each other in light intensity, the content of P in soil, depth of compact soil layer, number of species, as well as in cover-abundance of species representing different life forms, dispersal types, habitat affiliations and origins. Trampling leads to low plant cover and height of the undergrowth, as well as contributing to shallow localization of the compact soil layer near paths. Human movement on paths (walking, running, biking) with accompanying pets contributes to the successful dispersal of plants, resulting in high species richness. High light intensity in urban parks enhances the total number of species, cover-abundance of meadow and grassland plants, as well as cover-abundance of hemicryptophytes. The number of alien species was higher in parks than in forests, but the cover-abundance of alien plants was higher in forests than in parks. Urban forests are more suitable for the growth and biomass production of some alien herbs than urban parks, as mowing commonly used in parks appears to be an important factor in reducing their cover abundance. Regular fertilization and irrigation contribute to the high content of phosphorus in the soil, as well as to the high cover-abundance of meadow and grassland plants in urban parks. Urban forests enhance cover abundance of plants with dispersal mechanisms of the Bidens and Lycopodium types, whereas urban parks promote cover abundance of plants with the dispersal of the Allium type. Further study is needed to confirm the role of urban forests and parks in the preservation of ancient forest species, as well as to develop an appropriate design of paths that will allow the protection of vegetation and soil in urban forests and parks.