代わる and 替わる: acting for someone and replacement
Distinguish taking over someone's role from a person being replaced, without treating overlapping spellings of かわる as absolute categories.
Whose role is being taken over
病気の同僚に代わって、私が説明します。 means that the speaker will explain in place of a sick colleague. The person before に代わって is the one whose role is being taken over.
代わる is read かわる. 人に代わって describes taking on something that person would do, rather than merely standing beside them.
When the person in charge changes
四月から担当者が替わります。 announces a change of the person in charge from April. 替わる is also read かわる and highlights replacement of the person occupying a role.
次の休憩で運転を代わりましょうか。 offers to take over driving at the next break. 運転を names the task being taken over.
Read the relationship before judging the spelling
代 for acting in someone's place and 替 for replacement are useful tendencies, but personnel changes can involve both ideas. Identify who replaces whom rather than assuming only one spelling is always possible.
考え方が変わりました。 means that someone's way of thinking changed. It does not introduce another person taking over a role, so this is 変わる rather than the substitution examples.
Who gives the explanation in 同僚に代わって私が説明します?
Show the answer and why
The speaker, 私. The colleague is the person being replaced for the task, and 私が identifies who actually explains.

