The difference between a language and a dialect can best be explained through sociopolitical distinctions. Overall, what distinguishes a language from a dialect is a matter of officiality: a language is typically formally recognized by a national or international government, and it has its own writing system and literature. A dialect, by contrast, generally has neither of these things. This boils down to two things. First, languages typically have their own country and a high level of prestige while dialects are low-prestige and are not the official parlance of any country. Second, languages are typically standardized and have dictionaries and grammars dictating how they ought to be spoken while dialects do not. This distinction explains why the national languages of Sweden, Denmark, and Norway are classified as languages and not dialects despite the fact that the speakers of one can understand the others--each is defined by its own political boundaries, literature, and culture. Political separation has also caused a single language to be broken up into two or more separate languages; this is the case with Urdu and Hindi, for example, which used to be a single tongue.
This distinction of dividing languages based on prestige, political boundaries, and writing is too reductive to tell the whole story. Many languages cross political boundaries, such as French and Kurdish. Also, many other languages--especially indigenous languages--do not have their own countries and have not been declared an official language by any government, and yet are widely considered to be languages and not dialects. Lastly, a core tenet of linguistics is that writing is a nonessential byproduct of language; if writing was essential for a linguistic variety to be considered a language, then there are potentially thousands of languages that either do not use a writing system or existed before writing was invented that should be considered dialects instead--but they're not. There are too many exceptions and counterexamples, therefore, for this sociopolitical definition to hold. The other problem with this distinction rests on the concept of prestige. Typically, the dictionaries and grammars that dictate how a given language should be spoken are based on the high-prestige standard variant of that language while the other lower-prestige, stigmatized varieties are considered lesser, merely dialects that fail to meet that standard. In other words, a "language" is viewed as the ideal, and every other linguistic variety within that language is considered a "dialect." Using prestige as a metric to decide what is a language and what is a dialect implies that if a linguistic variety is low-prestige, it is too simple, lowly, and unsophisticated to be considered a full-fledged language.
Rejecting the premises
More on the language-dialect debate: https://www.economist.com/the-economist-explains/2014/02/16/how-a-dialect-differs-from-a-language An exploration of English dialectology: https://www.google.com/books/edition/American_English/vPdgBgAAQBAJ?hl=en&gbpv=1&dq=wolfram+and+schilling+2016&printsec=frontcover