Some brands and types of toothpaste contain xylitol especially xylitol toothpaste.
I do know that Colgate brand toothpaste does not contain any xylitol because the Colgate toothpaste is the brand of toothpaste I use.
So if your dog gets into Colgate toothpaste then it's not harmful to them but you should keep the toothpaste away from the dog anyway.
You can buy toothpaste that does contain xylitol but most toothpastes you buy in the stores does not contain any of the xylitol which is also an ingredient in most artificial sweeteners.
The ingredient xylitol is very toxic and poisonous to dogs so don't allow dogs to eat anything containing xylitol.