Script vs language: what is the difference?

A language is a system of communication. A script is a set of graphic signs used in writing. An orthography specifies how a particular language variety is written, including spelling conventions and its choice of letters and marks.

One script can serve many languages: Latin is associated with English and many others. One language can be associated with more than one script: compare Serbian in Cyrillic with Serbian in Latin. Shared script does not make two languages the same language.

ISO 639-3 identifiers label languages (and some macrolanguages), while ISO 15924 identifiers label scripts, including variants, composites and special-purpose codes. A Unicode block is different again: a code-point range that need not contain exactly one script.

This is why script detection cannot identify a language uniquely. Latin letters alone cannot tell you whether a text is English, Serbian or another Latin-script language.

Sources: ISO 639-3 registry and ISO 15924 registry.