Water keeps you alive. Salt flavours your food. Both can harm you in a large enough amount. This is one of the oldest ideas in the study of poisons: whether a molecule harms you depends on how much of it you take in.
The Swiss-born physician Paracelsus wrote it down in 1538: "All things are poison, and nothing is without poison. The dose alone makes a thing not a poison." People often shorten it to the dose makes the poison. A molecule your body needs can harm you when there is far too much of it, and a molecule known as a poison can pass through you safely when there is little enough.
Too little and too much
For many molecules your body needs, there is a healthy range in between too little and too much. Vitamin A, which your eyes use to see in dim light, is one. Without enough of it, your sight in the dark fails. Vitamin A dissolves in fat, so your body stores the extra in the liver until it is needed. Taken in day after day, more than the body can use builds up, and the NHS notes research suggesting that over many years this may affect the bones. The healthy amount sits between the two.
Salt, water and caffeine work the same way. Your nerves and muscles need the sodium and chloride ions in salt to work, and a little salt does no harm. Far too much strains the body that has to pass it out. Caffeine, the molecule in coffee and tea that blocks the receptor for the sleepy messenger adenosine, leaves most people feeling awake in the small amount a cup holds, and unwell in a much larger one.