Cut a slit in the caulking with a razor blade and pull the loose piece up with your fingers. Pull the caulking away from the edge of the shower slowly.
Scrape the rest of the caulk off with the razor blade, being careful not to scratch the tub. Make sure that all moldy caulk is removed or it will affect the new caulk. Use a putty knife if you prefer.
Clean with a mold and mildew cleaner and rinse thoroughly. Dry off the area with a clean towel.
Put down a bead of silicone caulk in the same place that you removed the old. Silicone caulk is water-resistant.
Press your finger into the caulk and move it along the bead to press it up against the shower and smooth it out. Allow the caulk to dry for a day before using the shower.