What Riley said.
In a survival situation if you have a suitable container, you can both boil and filter.
Boiling gets rid of the virusses, parasites and critters.
But , if you suspect chemicals, organics, and metals, you can filter also.
From your camp fire (made solely with wood), once it's died down, select the all back pieces left over, discard others. No ash either. The all black pieces are pretty much charcoal.
You can rinse the ash off of the pieces by running boiling water through it.
Crush the pieces into pea gravel size, you will end up that size, and on down to grains of sand and some black dust. Using a bandana, sock, or other piece of cloth make filter containing the charcoal.
Next, run some hot water through to rinse out any charcoal dust.
From there on, you have a field expediant charcoal filter.
if you magnified Charcoal , it wold look like a sea sponge, with lots of surface area, nooks and crannies. That's how it can trap chemicals. They basically get stuck in the molecular latticework of the charcoal.
You will have to dispose of it eventually, as a charcoal filter will "load up" and become less efffective. The good thing, is, you can dry it off, and burn it in your next fire.
If you find a soda can, or metal tin, you can make charcoal in that, by putting some hardwood (no bark) into the can, and place it on the fire. Don't let the wood inside actually catch fire, you just want all the other stuff in the wood to burn off, leaving you with pure charcoal.
If you have a plastic bottle, cut off the bottom, you can stuff your bandana or cloth that contains the charcoal down into the bottle, and pour water through it, allowing it to exit out of the cap-end of the bottle, like a funnel.
Charcoal filtering also removes foul tastes from your water.