PVC pipes work fine but if it's windy they'll sway really bad, or wood dowels if you're allowed. You should double the flag on itself at the end so that it creates a tube (then glue or staple to itself) and you can then insert the pole into it. I don't know if I'm being very clear, this is the flag seen from the top:
From what I understand flags have this shape in them already if you buy them, if you're making them then account for it that it's gonna make your flag a tiny bit smaller.
It's very makeshift, the flag can slide along the pole or even detach like this (you should add something at the top of the tube so that it doesn't slide down the pole), but it works fine for protests and such.