whether or not they would work before you feel the pain depends on what they are working on. If they are actually fixing something, like speeding up lactic acid metabolisation, reducing inflammation, relaxing muscle spasm and so on, then they will work while you sleep and reduce the pain that you feel when you wake. However if the pain relief doesn’t change what is causing the pain but just stops you feeling it, then it won’t work until there is pain for you to feel and you are feeling it. If the pain comes on while you are sleeping and gives you a bad nights sleep then taking pain relief before you go to sleep may help but only if there is still med in your system when the pain comes on.
Its absolutely clinically true that if you are in continuing pain then taking pain meds regularly whether you need them or not works better than only taking them once the pain is being felt, or worse, when the pain has become unbearable. hence the use of syringe drivers.