as it happens vs by the way

as it happens

adv
  • By coincidence, incidentally 

by the way

adv
  • Irrelevantly, off-topic. 

prep
  • Incidentally; used in referencing a parenthetical statement not timely, central, or crucial to the topic at hand; foregone, passed by, something that has already happened. 

How often have the words as it happens and by the way occurred in a corpus of books? (source: Google Ngram Viewer )