For those applications, I use 100% silicone caulk. Don't cheap out on it, you don't want to repeat this for as long as possible.
Regular kitchen and bath caulk will not hold up very long in a shower. Make sure you remove all traces of the old caulk before you put in the silicone. Rub it down with some alcohol and let that dry for a few minutes.
If you've not used 100% silicone before, you may want to use some tape and mask off about 1/8" on either side of the joint. After you put the silicone in and smooth it out, remove the tape immediately.
Should last for a few years, provided water isn't getting behind it from some other location.