Chemical used to clean washing machines
CLR works great for getting rid of line deposits. It can be used as a general washing machine cleaner when added to the machine (with no clothes) and run through a cycle. 
As far as your dryer is concerned, check the vent pipe for blockage, especially where it exits your house. Many have screens that can get blocked by lint over a long period of time.

This is copied from the CLR website:

Depending on whether you have a front or top loading machine, your directions for adding CLR are different. In both cases, though, do not use detergent or have clothes in the washer when you are using CLR. With a top loading machine, run your machine up to the main wash cycle and just before the machine starts to agitate, stop the machine. Add a ½ cup of CLR into the tub of the machine and finish the cycle.

When cleaning front loading machines, though, you need to change how you add the CLR. In front loading washing machines, the door locks once you begin the cycle. As a way around this issue, add a ½ cup of CLR to the machine where you normally would add your detergent or softener and run your machine.

With both types of washers, once the cycle with the CLR has finished, run an additional full cycle with just water. If your machine is high efficiency or “water saver” only use ¼ cup of CLR.