Secondary dominants or modal interchange

For example, say we have this chord progression: Cmaj - D7 - Gmaj - C. Most people would say this is a secondary dominant, since the D7 is resolving back to Gmaj, the dominant chord of C which of course resolves back to C. But could you not also classify the D7 as modal interchange given it is the second chord of C Lydian?

In other words, how could you tell if such is an example of a secondary dominant or modal interchange? Are they sometimes one and the same?