Aren't most pharmaceuticals organic compounds, so based on carbon ring structures that are much, much larger than a water molecule? According to this:
https://pubmed.ncbi.nlm.nih.gov/18656225/
RO systems have excellent rejection of pharmaceuticals. I suppose it depends on the quality of the RO membranes used too...
Edit: Yes, the membrane is important. Just found this:
https://www.sciencedirect.com/science/article/abs/pii/B9780444626578000100
Use the wrong one, and you don't remove pharmaceuticals.
Double steam distillation is the best, but it's just too expensive for large scale use.