The quality of the finished product is in the mix. The mastering is turning a good mix into say for example a vinyl master for vinyl, or a CD master for CD or a streaming master for streaming services. All would be mastered slightly differently according to the abilities/specifications of the medium.
Loudness, and translating across monitoring devices like home hifi, headphones, in the car or on mobile phones is all in the mix.
Mixing and mastering are terms that are often used interchangeably but they are different separate processes.
Getting your head around the idea of compression, how it works and how to use it can be one of the biggest hurdles, but once you get your head around it, combined with subtractive eq and panning, you can get everything to sit in the mix by removing unwanted frequencies that clash, controlling overly loud transients allowing you to bring up and even out everything else, or just sidechaining your kicks to your bassline so you get the most out of both without them peaking into the red. There is also parallel processing, like for example the NY compression technique, copying a channel, but processing the channel with heavy compression then mixing the two together to get a thicker result.
Ill explain compression in simple terms, compression = level reduction.
THRESHOLD decides when compression will trigger, the RATIO decides at what ratio it will reduce the signal that goes over the threshold 2:1 = halves the level, 4:1 quarters the level, 8:1 divides level by 8 etc etc. Ratio's over 10:1 are considered limiting as limiting is simply compression with an infinite ratio.
ATTACK decides how quickly compression will be applied. Slower attack allows more transient through, use very fast attack and release when sidechaining kick to bassline.
RELEASE is how quickly the level reduction returns back to no level reduction, it can create some nice pumping effects in genres like house.
GAIN. You use the gain to bring the overall level back up to where it was before now that the offending peaks have been tamed. (Not used when sidechaining kick to bassline)
Judicious use of compression allows you to tame peaks and bring down your crest factor(the difference between the lowest peaks and the highest peaks). A low crest factor creates a good loud mix ready for mastering. Then there comes things like saturation which really really makes a lot of difference.
Its never too late to start learning mixing and making the most of what you already have at your disposal. If you paid to have every song mixed and mastered by a pro, you would be broke. Just being able to make the most of what you already have will go a long way, and if a song could be a hit, then have it mixed and mastered by a pro then. Or if you produce an album, maybe pay a pro to mix and master it. But no point paying a fortune to get every track mixed and mastered, especially if you can do a lot of the work yourself.
It will take some time, but that time can be rewarding.
I have seen mixed reviews on online mastering services. But AI is getting better all the time.