A CT scan on the other hand does use radiation and quite a large dose of it, at least with the older machines. IIRC a single CT scan of the head results in a noticeable rise in the statistical risk of developing some form of cancer. I'm surprised sometimes at how freely they are used, personally I would weigh very carefully the medical benefit of getting a CT scan in the particular circumstances and discuss that with my doctor before getting one.
Historically, this is definitely true.
A whole body CT scan on earlier generation machines was said to carry an approx 1 in 1000 risk of cancer over the next 20-30 years, with a head CT scan approx 1 in 10000.
Modern devices are much better - close to an order of magnitude better with a variety of strategies: sophisticated exposure control algorithms, higher sensitivity detectors, better reconstruction techniques and noise reduction algorithms (now using deep learning).
There has been a lot of effort to raise awareness of this in the medical community over the last decade or so, with a variety of campaigns with names like "image wisely" and "image gently", aiming to ensure that CT was used only when necessary, and that the minimum examination with the minimum acceptable image quality was used.
MRI is definitely preferable in many cases , because it avoids the ionising radiation - the image quality and diagnostic performance is also better in most cases, at the cost of longer examination duration and higher cost. (Edit for clarification - There are certainly cases where CT is clearly preferable, e.g. bone where very high X-ray contrast yields excellent images, and where the lack of mobile water hydrogen nuclei means MRI works less well; similarly much emergency work is CT based, because time is of the essence - a CT examination which can be completed in 10-15 minutes is a huge advantage if an MRI might take 1-2 hours; finally in many cases, the different physical processes used by CT and MRI give different diagnostic information, so for some work, CT and MRI give complementary information and both may be needed for diagnosis).
MRI has its own safety issues - such as ferromagnetic objects and magnets and electrical conductors, as well as heating. RF related heating (SAR) can be substantial with MRI - there is a regulatory limit of 4.0 W/kg whole body averaged over 6 minutes, which is actually quite a substantial heat load. Local heating can be higher under certain circumstances - for example, crossing your legs forms a loop antenna, and the current flow across the high impedance skin-to-skin contact patch can result in sufficient heating to cause 2nd or 3rd degree burns.