It is mostly commonly used to write programs that output HTML based on information in databases and data typed into forms on webpages by users - but has plenty of non-web related uses.
Any website can use PHP, providing the webserver can run programs written in the language.
you turn up at a web page and you're presented with some html, but the html instead of being static/the same for everyone that turns up there, whenever they turn up, it is dynamically created by the php script at the time of you requesting the page