Tremendous progresses have been achieved for the proton structure and radius measurements, but not so many for the neutron. In this paper, we extract the mass radii of the neutron and the proton from the analysis of the differential cross sections of near-threshold ω and φ photoproductions on deuterium target, which is regarded as a quasi-free neutron plus a quasi-free proton. The incoherent data of ω and φ photoproductions are provided by CBELSA/TAPS collaboration and LEPS collaboration respectively, where the deuteron is disintegrated in the experiments to measure the properties of the individual nucleons. With the near-threshold data of γd → ωn(p) and γd → ωp(n), the neutron and proton mass radii are determined to be 0.795 ± 0.092 fm and 0.741 ± 0.028 fm respectively. With the near-threshold and incoherent φ photoproduction data of γd → φpn, the average mass radius of the bound nucleon (neutron or proton) inside the deuteron is extracted to be 0.752 ± 0.039 fm. For a comparison study, we also extract the mass radius of the free proton from the exclusive and inclusive ω photoproductions on the hydrogen target by the CBELSA/TAPS collaboration. From our analysis, we find that the neutron mass radius is close to the proton mass radius with no obvious difference, and the nuclear modification on the mass radius is not significant inside the deuteron.