Not that long ago the two were closely related and a PhD in math was / is a Dr. phil. The point of view of mathematics as a language for the natural sciences is quite modern. Many mathematicians some hundred years ago studied philosophy and mathematics, and often theology and law. The latter for the better perspective to earn a living. They are still closely related when it comes to logic and set theory. And philosophers like Russell, Popper, Wittgenstein were travellers between the subjects - some more and some less.
I think it is harder to separate the two as to answer: both.