The solar neighbourhood is populated by nearby (<200pc), young (<100Myr) moving groups (NYMGs) of stars, whose origins are still debated. A possible explanation is that they are remnants of individual stellar clusters and associations, currently dispersing in the Galactic disc. We aim to derive the initial mass function (IMF) of a large sample of NYMGs. We developed and applied an algorithm that uses photometric and astrometric data from Gaia DR3 to detect NYMGs as over-densities in a kinematic space, whose members distribute along young isochrones. We inferred individual masses from the photometry of both the detected and the previously known candidates. We estimated the IMFs for 33 groups, 30 of them for the first time, in an average mass range 0.1<m/M_{sun}_<5, with some groups going as low as 0.02M_{sun}_ and as high as 10M_{sun}_. We parameterized these IMFs using a log-normal distribution for m<1M_{sun}_ and a power-law for m>1M_{sun}_. We detected 4166 source candidate members of 44 known groups, including 2545 new candidates. We recovered 44-54 percent of the literature candidates and estimated a contamination rate from old field stars of 16-24 percent. The candidates of the detected groups distribute along young isochrones, suggesting that they are potential members of NYMGs. Parameterizations of both the average of the 33 IMFs based on our detections (mc=0.25+/-0.17M_{sun}_, sigmac=0.45+/-0.17, and alpha=-2.26+/-0.09) and the one based on the known candidates from the literature (mc=0.22+/-0.14M_{sun}_, sigmac=0.45+/-0.17, and alpha=-2.45+/-0.06) are in agreement with the IMF parameterization of the solar neighbourhood and young stellar associations. Our parameterization of the average IMF, together with the distribution of the detected group members along young isochrones, provides strong evidence suggesting that the NYMGs are remnants of individual stellar associations and clusters, and that there are no systematic biases in our detection and in the literature in the mass range 0.1<m/M_{sun}_<10.