The process by which a phagocyte (a type of white blood cell) surrounds and destroys foreign substances (such as bacteria) and removes dead cells.