The key to RNA's versatility is its chemical structure. It's made from just 4 simple building blocks, yet RNA can take on a nearly infinite variety of shapes. And its three-dimensional shape in part determines what an RNA molecule can do.
Even though RNA is single-stranded (unlike DNA, which is made up of two strands), it can still form complementary base pairs. Complementary sections within a single strand of RNA can base-pair with each other, causing the molecule to fold in on itself and form a complex, three-dimensional shape.
The sequence of bases along the RNA strand determines how it will fold. In this way, the sequence of bases determines the strand's three-dimensional shape. Changing the bases will change both the molecule's shape and its function. It is this flexibility that makes RNA such a versatile molecule.