In our unit the official policy is that a baby not be held while a UAC/UVC is in place in order to protect the line and keep the insertion site visible to the care providers, however depending on the comfort of the RN and the parents (who we try to educate as much as possible about the reason for and risks of having the lines in) we may consult with the practitioner about the possibility of holding the infant.
I know there are some nurses who never do it and some who consider it nursing judgement, but for the most part we'll discuss it with whoever is overseeing the baby's care, mention our thoughts on the infant, the parents, and our comfort with the situation individually. Some nurses will do it only if they receive a written order allowing the parents to hold the infant, so they have some backup that they did consult with a practitioner about whether it was okay, "just in case".
From my observation, the practitioners generally give the go-ahead if they feel the infant is otherwise stable enough to be held, and they usually add a "Protect the line with your life" sort of instruction
If the infant is dying, the parents are able to, and encouraged to, hold their child, regardless of the lines/tubes in place.