When it shall appear from said petition or otherwise, at any time during the proceedings upon such petition, that any infant, insane or distracted person is interested in any property that is to be taken or damaged, the court shall appoint a guardian ad litem for such infant or insane or distracted person to appear and defend for him, her or them; and the court shall make such order or decree as it shall deem proper to protect and secure the interest of such infant or insane or distracted person in such property, or the compensation which shall be awarded therefor.