My tooth hurts very bad, I believe it is a cavity but it could be worse. I haven't visited the dentist because I have no insurance. What should I do?

Visit a Dentist. This will not self cure. Nothing available OTC will affect a cure. Find a Dentist, arrange a payment plan, and get the work done before it gets worse. The longer you delay, the worse the problem becomes,the more expensive treatment will be. Social Services can direct you to subsidized care if you qualify. Dental Schools offer treatment at will below typical private office fees. Don't delay.
Visit the dentist. More than half the population does not have dental insurance, so you are not alone. People without insurance still take care of their health. You will need to pay for your treatment, just like you pay for many other things in life.