It depends on whether the "gaps" that you mentioned are cavities or whether actual spaces between your teeth. If it's cavities, then you need to get them filled before they get deeper and reach the tooth nerve. And if it's spaces, then that can be closed with either orthodontic treatment or other prosthetic options.
Next Steps
You need to visit a dentist as soon as possible to evaluate the cause of your problem.
Health Tips
Until you visit your dentist, floss after every meal and keep those gaps clear of food debris. This will make sure that your gums don't remain swollen and cause further pain and discomfort.