Yes it's OK to swallow phlegm however it's not the best thing to do.
Swallowing your own phlegm is not gonna hurt you but if you have phlegm in your throat then you really should cough up the phlegm and spit out the phlegm.
The phlegm contains bacteria and germs that your body wants to and needs to get rid of and when you swallow that phlegm it makes your illness last longer.
If you have no other choice but to swallow the phlegm then it's okay to do so.
However if you can go spit out the phlegm then spitting out the phlegm is the best thing for you to do.
I have swallowed phlegm before when needed but most times I spit the phlegm out which is what is best for our bodies.