Blood–brain barrier
For example, things that the brain needs to survive (water, glucose, and amino acids) can get through the barrier.  However, the barrier stops many harmful things, like bacteria and viruses, from getting into the brain.  This helps protect the brain from getting an infection.