The well-known second quotation, although frequently ascribed to M.K.Gandhi, cannot be traced in his original texts or speeches.

However, as reported by the Gandhi Institute for Nonviolence the Gandhi family states that M. K. Gandhi was known to have said this line many times in his lifetime and believes it to be original with him.
(details: https://quoteinvestigator.com/2017/10/23/be-change/)

And, maybe more important, we know that he lived according to this maxim.