There are several that make the claim to be able to do both, but I have not been able to test any with a lab. Most can effectively remove biological contaminants, as can boiling the water. Some chemicals might be removed by boiling as well, if they are more volatile than the water. Others might be removed (heavier metals and chemicals) by setting up a still of sorts, so the water steams away and then is condensed back into liquid. In an emergency situation I would probably try about anything I could if I needed water that badly.

The key to the ability to remove heavy metals and chemicals is an activated carbon filter component.

You can minimize the quantity of chemicals if you draw your water from a clean (or cleaner) source. Pay attention to the sources of contamination, direction of flow and the original source.

For potential water purification needs, I always carry a metal cup or pot to boil water in.