Stellar half-mass radii of 0.5 z < 2.3 galaxies: Comparison with JWST/NIRCam half-light radii