Until about the 1700's, people made no distinction between the two fields. Science tries to gain knowledge about a specific subject, and philosophy concerns itself with the laws and structure of all reality. One requires a laboratory and the other has no laboratory. Philosophy and religion are separated. Religion assumes that God can be known, and develops a ritual, a creed, and a moral code based on such assumptions.
Philosophy makes no such assumptions.
It examines the logic behind religious proofs, and tests the methods of investigation that religion uses. The nature of the universe has challenged philosophers since ancient times. Many early peoples believed that the universe was composed of only one element. Some ancient Greek philosophers claimed it was all water, all air, or all fire. Later philosophers believed in the Mechanist Philosophy which states that the universe behaves like a giant machine, according to physical laws of cause and effect.