Why collisions are not something to plan around
A version 4 UUID has 122 random bits. The number of values that gives you is large enough that the usual comparisons stop being helpful, but the practical consequence is simple: generating a billion a second for a century leaves the chance of a single duplicate at roughly one in a billion.
This is why UUIDs can be generated independently on different machines, offline, with no coordination, and still be safe to use as primary keys. That property — not the length, and not the format — is the entire reason they exist.
The exception is a generator that is not actually random. A UUID built from Math.random or from a poorly seeded source can and does repeat, and the failure is invisible until two records collide in production. That is the reason this page uses the browser's cryptographic source.