This is all assuming that there is a galvanic separation with the mains voltage. For example by a transformer on a well designed board. I have seen instances on this forum where that was not the case.
So, normally it should be safe, but not always..
If in doubt send a picture of your setup to this forum.