Hi,
As you mentioned you can see a cavity in your tooth which is painful/sensitive to food and cold.
Next Steps
Please get your dental check up done soon. Possibly it may get filled with dental composite (most preferred) or dental cement (economical option), but in case the cavity is big then the root canal treatment (treatment of your tooth nerves) is advised.
Take care.
Health Tips
If root canal treatment is advised then don't forget to get a tooth cap onto the tooth, as cap gives strength to the tooth. Clean your teeth with water after meals to avoid lodging of the food there.