Both of those bikes are fine as trail bikes. They are longer travel (what used to be called all-mountain setup versus a traditional cross country), but unless you're racing or riding completely smooth trails (where you'd probably be better off with a hard tail), you probably will like the slightly longer travel. They also have a more slack head angle which gives you a more aggressive feel (much easier to go down technical sections of trail). Again, most bikes are trending this way and with the same race/really easy trail caveat, most people prefer slacker head angles these days. Neither bike is likely to be overly light, but at that price range you are unlikely to find a light build as the components are all lower end. Still, if you want more of a pure cross country geometry, you could go for something like the following (similar price range and component quality, but less suspension travel, still fairly slack though):
https://www.competitivecyclist.com/...pbiBCaWtlcyAmIEZyYW1lczoyOjEwOmNjQ2F0MTAwMTYw
Between the Canyon and the Specialized, the component sets are pretty comparable. The biggest difference is the XT 11 speed derailleur on the specialized vs NX 12 speed on the Canyon. The added range on the 12 speed is nice although that specific one is 11-50 versus the 10-50 that most other Eagles have (the 11 speed Shimano is 11-46 so only about 10% difference versus the 20% difference you get with the wider range Eagle). 12 speed is harder to keep in tune though as the tolerances are tighter. Further, the NX series is the lowest quality that SRAM makes. XT is a mid range derailleur from Shimano and is going to shift smoother and be more reliable. I have XT on some bikes and SRAM Eagle GX (one step up from NX) on others and I find the XT is smoother and more reliable than the GX so probably even more noticeable compared to NX (which I haven't run). Given how noticeable shifting is on a bike when you ride it, with the almost certain better experience with the XT, I'd probably go with the Specialized on that basis alone.
In the price range you're looking at, I doubt you'll find much better than the two you are looking at (there aren't many options and they all have pretty similar builds). It's a bad time of year to be buying a bike as most of the clearance bikes are gone from last year, but you still can find some. If you're price range isn't set, the following is more expensive, but a much better bike and component set. It's a similar mid travel bike, but has 29" wheels (they also have the 27.5" version, but if you like to pedal you'll probably like 29" more).
https://www.backcountry.com/pivot-s...MIgrjTy-Tv6AIVY5JbCh1OMAIGEAkYBCABEgKCPvD_BwE