Different words use ph or f, depending on the word origin. English words with a Greek origin tend to use ph; others use f:
catastrophe graph professor serif
In a few cases, the word can be spelled either way. This is most familiar in the choice between sulphur and sulfur, where sulfur is mandated as the scientific spelling by the International Union of Pure and Applied Chemistry (see Spelling in chemistry). Sulphur remains in the names of fauna (eg sulphur-crested cockatoo) and in literary usage as sulphurous.