If you do this, it will be one of the most intelligent and beneficial decisions you are likely to ever make. Not only will it help you with the conditions that you are concerned about, It has been shown that eliminating dairy and gluten from your diet can decrease feelings of anxiety, nausea, and panic attacks. Also, you'll have an easier time sleeping, and have more energy. Your skin will look better your hair and your nails will look better. Also, you'll be bound to eat healthier because foods that are stock full of cheese and wheat are usually drenched in oils or overly processed. That will lead to you losing more weight, lowering your sodium, lowering your cholesterol, and leveling your blood pressure to normal levels.
Many people buy gluten-free products thinking this will help them lose weight, but that's not always the case. Gluten causes lots of inflammation in the small intestine for people with Celiac disease- so a gluten free diet is beneficial for them. There are some researchers out there that believe a gluten-free diet reduces inflammation through-out the entire body and also cures autism. I'm not entirely convinced of the autism theory, but the inflammation theory makes a lot of sense.
It would depend on what is causing the pain. It can take a lot of work and some additional expense to eat a healthy, well-balanced diet free of dairy and gluten. It's become sort of fashionable to have a food intolerance in some circles; eliminating one or both might not solve your problems. Keep a food diary for 2 weeks; write down everything you put in your mouth and note symptoms of discomfort or pain. If you notice a pattern, then your problem may well be dietary.