Do a 75% water change and gravel clean the substrate any day you have an ammonia or nitrite reading above 0ppm, or a nitrate reading above 20ppm.
Make sure any new water is free of chlorine/ chloramine before it's added to the tank.
Reduce feeding until ammonia and nitrite are 0ppm.
Add some liquid filter bacteria supplement, sold at most pet shops. Add a double dose every day for 1 week, then pour the remaining contents into the tank. Try to add the supplement near the filter intake so the bacteria get drawn into the filter where they belong.
Don't replace filter media/ materials because they contain the good filter bacteria. Just wash the media out in a bucket of tank water and re-use the media. Tip the bucket of dirty water on the lawn. If you need to replace filter pads/ cartridges, put a piece of foam from another brand of filter into your filter and leave it there for a month before removing the old pad/ cartridge. Sponges last for years and get cleaned in a bucket of water, the same as the other media.