substituted for/replace

  1. Ms Smith substituted for Ms Jones as teacher of the chemistry class today, since Ms Jones was ill.
  2. Ms Smith replaced Ms Jones as teacher of the chemistry class today, since Ms Jones was ill.
    Can both sentences be used interchangeably?
    Should I correct ‘as teacher’ by ‘as a teacher’?

They are both OK and mean the same. You do not need “a”.

Dozy,

  1. Butter can be substituted with margarine in this recipe.
  2. Butter can be replaced with margarine in this recipe.
    Are both correct?
    Can we always use ‘substitute’ and ‘replace’ interchangeably?

I do not personally like that use of “substituted”.

Ms Smith substituted Ms Jones as teacher of the chemistry class today, since Ms Jones was ill.
What about the sentence now?