Including different kinds of length distinctions, such as in stressed syllables only, or stressed and unstressed, etc.
None of the standard resources for this sort of typological information, it would seem, have helpful information to answer this question as accurately as one might like. That being said, both UPSID and the World Phonotactics Database can help us give an initial plausible range. Both have entries for long vowels, but these include all long vowels, so, for instance, English is included, despite the fact that while vowels like in beet /iː/ are phonetically long, there is no phonemic length contrast in English.
UPSID's dataset says that 51 languages, or around 11% of their dataset have long vowels. Some of these are obvious cases where the entry is spurious, at least as it relates to phonemic vowel contrasts.
While the World Phonotactics Database does not actually give an accessible list of segment inventories, it's dataset contains 1,384 languages with long vowels, around 34% of its total sample. A number of these will likely not represent phonemic length contrasts.
So our estimate should be no less than 10% of the world's languages, based on the UPSID data, and no more than 33%, based on the World Phonotactics Database. Due to the size of UPSID's dataset, my guess would be that the true number is somewhere closer to the number found in the World Phonotactics Database, something like 25% of the world's languages.
There are also 3-way length contrasts, but these are quite rare, and all examples I know of (Estonian, Mixe languages, Wichita, etc.) are at least debatably analyzed without resorting to anything more than a 2-way contrast.
While I can't give a definitive answer, I can just say it's somewhat to very common. Within the Indo-European family, almost all the branches have at one point had vowel length (Germanic, Italic, Slavic, Indo-Aryan, Greek, Anatolian, Celtic etc.) and many have had it re-innovated (certain English dialects' treatment of /eə > e:/, Belgian French compensatory lengthening before a lost /s/ etc.) . Outside the IE family, there's Uralic where vowel length is quite widespread amongst almost every member of the family, then in Korean, Japanese, certain members of Turkic, Bantu, Mongolian, Afro-Asiatic, Uto-Aztecan, Athabaskan, Wakashan, Algonquian, Mayan etc.
This just shows that it's not really a local phenomenon as vowel length appears in about any area where there are languages; some areas might have vowel length more common, though.