It used to be Nikon for the sensor and Canon for the glass;
I'd flip that around.
Canon embraced and improved CMOS sensors pretty much from the get-go, while Nikon stubbornly clung to CCDs well past their prime. They even tried their hand at developing their own proprietary sensor(LB-CAST) which was by pretty much any much any measure a miserable failure. The 4mp LBCAST sensor in the D2H was as noisy as the 12mp CMOS in the D2X, had less dynamic range, and introduced weird color artifacts when the channels "clipped."
Canon has always been a camera company, and Nikon has always been an optics company. I say that not to disparage either, but just to say that Nikkor optics have some well deserved reverence. The first Canon(Kwanon) cameras used Nikon(Nipon Kogaku) lenses-Canon only had to start designing lenses when Nikon decided to make cameras and shut off supplying lenses to them(although they made lenses for others-the Bronica S2A I had mostly had Nikkor optics). Nikon microscopes and other non-photographic optical instruments are still a big part of their business.
By the time of the first commercial viable DSLRs, both companies made great optics, but Nikon also had a big legacy history behind them. Canon WAS always ready to experiment with new or exotic techniques like fluorite elements(something they were doing in the 80s but which Nikon only recently did) and mass production aspherics. Nikon did start pushing ED glass in the 80s-something which solved the same problem as fluorite(CA in telephotos) while being both more durable and dimensionally stable, but at a significant weight penalty. BTW, the red "L" band on Canons originally signified either exotic optics(asperical or fluorite) while big teles were white to help reduce the thermal expansion of fluorite in the sun(something that was noticed as a real problem in the black/green band fluorite lenses). BTW, Nikon also use to use a gold band to indicate ED-now it's hit or miss as to whether it's there, and instead the gold band seems to mostly mean "high end lens here"(cheaper lenses have foil or paint, while the more expensive ones actually have it inlaid).
Now, Nikon throws ED glass in everything including $100 kit zooms. Canon has similar technology but doesn't advertise it. Molded and/or hybrid aspherical elements(as opposed to hand-ground) are also common in both company's lenses.
On the whole, I'd put their glass quality about equal. If you want really good manual focus lenses, Nikon is the only realistic choice. Both companies make certain lenses that don't have an equivalent in the other brand, or at least the closest comparable option isn't nearly as good.
One other thing worth mentioning-Canon seems to run a couple of years ahead on adding certain technologies vs. Nikon. IS/VR is the example that comes to mind, but also the ring ultrasonic focus motor. Canon has had stepper motor lenses for a while, while the number of Nikon ones is limited, although I don't necessarily consider that an advantage. The EF mount was designed to be very "forward thinking" and is totally electronic, while the F mount has been modified extensively over the years to the point where only now is it all electronic on a handful of lenses(although all cameras still retain the stop down lever). Canon has always used in-lens motors, while Nikon initially only used them for super-teles. Nikon manages to get pretty impressive AF speeds with in-body motors on some cameras(I'd put the F5, D1 series, and D2 series as kings here, with an advantage to the F5 in terms of sheer torque and an advantage to the D2 in terms of a lot of torque combined with a better AF module) but it's loud. In-lens motors are now ubiquitous and only lacking in the current line-up in some fairly old designs-they're common enough that Nikon has been leaving in-body AF motors out of low end consumer DSLRs for 10 years now. Leaving out EF-S lenses, every EOS mount lens is fully backward and forward compatible with every EOS camera.
Nikon's lens compatibility is a disaster. Leaving out the pre-AI/AI distinction, some lenses are crippled on certain bodies. Legacy compatibility has been eroding for years. I could take the 14mm f/2.8(introduced around 2000) and with a small, officially supported factory modification(supported to the point that Nikon marks the place to drill holes for it to be done) I could have it meter on a Nikon F. Even without metering, it's functionally fine. Not to long ago, I modified my 180mm f/2.8 to do just that(a previous owner had also done and undone it, but the drilled and tapped holes on the aperture ring gave it away). On the same Nikon F, the new AF-P 70-300 f/4.5-5.6 will only work wide open at infinity. I think my D800 is the only camera that can focus it-even manually. On the other hand, let's say you're a D3500 user and want to buy the 105mm f/2 DC for portraits-not only do you have to manually focus it, but you also don't get any metering on this camera.