Can someone please elaborate on the concept of singing on pitch and also is there a such thing as rapping on pitch?
On pitch in the broadest sense is 'hitting the note you were supposed to hit'.
Being in tune with any external reference, instrumentation etc.
What that note ought to be is initially determined by the songwriter, whether that's you or Mozart.
How to ensure you know what that note will be can be determined in a few ways. Most rely on pure memory; that once you got it right once you can remember how it went & can repeat that.
All the examples below require repetition.
Practising over & over until you learn.
Even just singing along to a record on the radio requires you have heard that song enough times to remember the melody & at least a few of the lyrics.
Someone plays a note, for instance on a piano, & you sing the same note back to them. This can be extended to an entire song, with practise.
Someone plays a chord or root note, & you recall the interval between that note & the one you need to start on. Requires memory & knowledge of what that interval should be.
It can be written as sheet music.
This might be the hardest to determine if you are singing on your own with no external reference, but using either of the above references can get you started. It requires less in the way of memory & more in the ability to read & convert those dots into pitches in your head, then from your voice.
People with perfect pitch just 'know' which note is which & need no external reference. The rest of us have what is called 'relative pitch' - so we need a reminder of the start point & can confidently continue from there.
At the other end of the scale there are people with neither perfect not relative pitch. They are unable to perceive whether any note is higher or lower than the preceding one & so cannot determine even where to start or when they get it right. This is rare, but real. Most people even with no training or experience at all can sing a simple tune they have just heard.