Exploring the high-mass end of the stellar mass function of star-forming galaxies at cosmic noon