My understanding was you can use a trademarked name but only if it was in an unrelated category. Clearly no one will confuse a phone running Oreo with a cookie you eat and dip in milk. now if google made a cookie and called it oreo, they would get sued. But IANAL and am probably totally wrong here.
Your understanding covers the basic intent of U.S. trademarks, but it got much more complicated with the Federal Trademark Dilution Act of 1995: https://en.wikipedia.org/wiki/Federal_Trademark_Dilution_Act. Nowadays, impairing a famous trademark's distinctiveness can be an issue, even in the absence of confusion or competition.