Hopefully everyone understands to razz and to rag as meaning to tease/ridicule on account of I don't have anything specific to reference. I'm curious to know which word came first and why both words--rag and razz--were chosen for teasing and ridiculing. I'm having difficulty uncovering their etymologies in regards to these meanings.
razz slang (orig. and chiefly US). trans.
To deride, jeer; to mock or make fun of (a person or thing).
...for which the first citation is 1918. They list the noun form razzing (also derived from raspberry = contemptuous blowing sound) a year earlier in 1917.
rag trans. slang. (etymology uncertain, perhaps from rag = tear, rend, rip)
tease or torment; (originally University slang) to make fun of in a rough or boisterous manner
Where the first citation for that exact sense is 1749, with the cognate BrE slang rag = scold, reprove a decade earlier.
Personally I've rarely encountered the above use of razz, perhaps because it's still essentially US slang. I'm more familiar with the (mainly BrE slang) usage...
on the razz (from razzle) out having a good time, socializing, or drinking.
TL;DR: For OP's specific sense, rag is much older than razz.