Ultracool dwarfs (UCDs) encompass a wide variety of compact stellar-like objects with spectra classified as late-M, L, T, and Y. Most of them have been discovered using wide-field imaging surveys. The Virtual Observatory (VO) has proven to be of great utility to efficiently exploit these astronomical resources. We aim to validate a VO methodology designed to discover and characterize UCDs in deep extragalactic surveys like Advance Large Homogeneous Area Medium-Band Redshift Astronomical (ALHAMBRA) and Cosmological Evolution Survey (COSMOS). Three complimentary searches based on parallaxes, proper motions and colours, respectively, were carried out. A total of 897 candidate UCDs were found, with only 16 previously reported in SIMBAD. Most of the new UCDs reported here are likely late-M and L dwarfs because of the limitations imposed by the utilization of optical (Gaia DR2 and r-band) data. We complement ALHAMBRA and COSMOS photometry with other catalogues in the optical and infrared using VOSA, a VO tool that estimates effective temperatures from the spectral energy distribution fitting to collections of theoretical models. The agreement between the number of UCDs found in the COSMOS field and theoretical estimations together with the low false-negative rate (known UCDs not discovered in our search) validates the methodology proposed in this work, which will be used in the forthcoming wide and deep surveys provided by the Euclid space mission. Simulations of Euclid number counts for UCDs detectable in different photometric passbands are presented for a wide survey area of 15000deg^2^, and the limitations of applicability of Euclid data to detect UCDs using the methods employed in this paper are discussed.