Vet here.
It is fine in most cases if your doggo is healthy, checked clear for worms, not on a raw based diet and not inherently a scavenger but it's never 100% safe. I personally would not take the risk but I know many people have rimmed dogs and they still turn out okay.
Dogs can potentially shed nasty bacteria like campylobacter, salmonella, E. Coli and parasites like giardia for example.
If you keep him/her anus and perianal area as clean as you possible, you may hopefully reduce the risk of picking up anything.