In theory, they mean the same thing and can be used interchangeably, but in practice, this is not usually the case.
I rarely use "lengua", in fact, I usually just saw it in text books. But in an informal context (at least in my country), it was almost never used. For example, people would say "hablo 3 idiomas" (I speak 3 languages) instead of "hablo 3 lenguas" (I speak 3 tongues), it would technically be correct but it just doesn't sound very natural.
It's basically the same as in English, how we can say "native language" or "mother tongue" (after all, lengua literally means tongue).