Canon EOS, EOS M, and EOS R are all interchangeable-lens systems.
In some cases, an adapter can be used to put a lens from one EOS system onto a camera body of a different EOS system. In other cases you cannot; the physical characteristics make it impossible.
(1987 – 2004) Canon EOS cameras were SLR film cameras and then DSLR digital cameras; unlike previous camera systems, the EF lens mount is completely electronic.
(2012 – 2019) Canon EOS M cameras have EF-M lens mount.
(2018 – ) Canon EOS R cameras have RF lens mount.
* Original Canon EOS camera bodies are either 35mm SLR or DSLR with image sensors up to Full-frame (same size as 35mm).
EOS camera bodies employ EF lens mount but the lenses have two variations, EF and EF-S. EF lenses are compatible with full-frame/35mm image sensors, while the EF-S lenes are limited to smaller APS-C (crop sensor). EF-S lenses tend to be physically smaller than their EF counterparts.
* Canon EOS M cameras are all mirrorless and support image sensors up to APS-C.
* Canon EOS R cameras are all mirrorless and support image sensors up to Full-frame.
In general, lenses designed for APS-C (EF-S lenses or M lenses) cannot be used on Full-frame cameras. Possibly you might fit an EF-S lens onto an EF camera body, but potentially the reflex mirror inside the camera could physically hit the back of the lens. If that doesn’t happen, you will likely encounter one or two problems. Sharp focus may not be impossible because the distance between the lens and image sensor is incorrect. At wide apertures, the corners of the image may be dark because the lens is designed for a smaller image sensor.
In general, lenses for mirrorless cameras cannot be used on DSLR camera bodies. This is because the distance between the lens flange and the image sensor is shorter and there is no room for the mirror inherent in DSLR cameras.
EF lenses can be used on most any camera body. perhaps with help of an adapter.
EF-S may or may not fit onto an EF camera body, but don’t try it.
EF-S lenses can be used on APS-C camera bodies, including EF-M and RF with help of an adapter.
EF-M and EF-R lenses cannot be used on camera bodies with EF mount (regardless of the image sensor size)
EF-M lenses can only be used on M-series camera bodies. Technically, an M lens could work on an EOS R-series camera, but no such adapter exists. (As Canon never made many lenses for the M system, likely no adapter will ever exist.)
RF lenses can only be used on R-series camera bodies. (Considering the possibility of an adapter to put an RF lens on an M-series camera body, it seems not possible because the physical diameter of the RF lens mount is larger than EF-M.)