In the presence of tetrahydrofolate, catalyzes the oxidative demethylation of sarcosine to yield glycine, 5,10-methylenetetrahydrofolate and hydrogen peroxide. In the absence of tetrahydrofolate, catalyzes the oxidative demethylation of sarcosine to yield glycine, formaldehyde and hydrogen peroxide