"They have a function. Whether or not they have a 'purpose' is a matter of philosophy or religion, not science."
It's a semantic differnce. Purpose and function are the same thing, unless you chose to attribute more meaning to one than the other.
Then use the word "function" when that is all that matters.
They are not the same thing. "Function" is descriptive, telling what a particular thing does. "Purpose" introduces a teleological element which is not present in the bare observation of the thing being studied. Science deals with 'function'. 'Purpose' is properly the subject of philosophy and religion.