My name is***** and I am sorry to hear that your dog is acting so strangely.
Could she have gotten into anything such as human medications, mushrooms or similar?
Could she have been injured in some way? Spider or scorpion bite?
Any diarrhea or vomiting?
Based on your description, pain of some sort is the most likely. Anal glands are possible, but they don't usually start hurting out of the blue. Other possibilities include abdominal pain such as gas cramps, or impending diarrhea, tail or hip pain, slipped disk in her back, and others.
Less likely possible causes include adverse reactions to medications if she got into human medications, hallucinations from toads or mushrooms or medications.
I would examine her closely to look for signs of external injury. If that is normal, I would watch her closely for the next few hours for diarrhea, vomiting, swelling of body parts or other abnormal symptoms. If you see any of these, I would consider taking her to your local animal emergency room tonight.
If there is nothing unusual besides the behavior tonight and she is still acting weird in the morning, I recommend taking her to see your regular vet first thing in the morning.
Does this help? Do you have any other questions?