when to go to the ER?

I've been having pains in my back and legs, I have nerve damage in my foot, and this has been happening for 4 hours, I can't sleep. It's even kind of doing it in my neck.