Safe for the baby !

I've been having terrible back pains and minor cramps, I'm almost 5 weeks. I was wondering is there any sort of pain medication that is ok to take when pregnant? So far I've just dealt with it. But these back pains make it hard to sleep 😔