Daniel McKnight appeared on petition at Dumfries Sheriff Court charged with murder and two other charges, including defeating the ends of justice. He made no plea and was remanded in custody.
Kelsey Hunter was last seen in the Cotton Street area of Castle Douglas at 17:00 on Saturday. A major search is under way in the nearby village of Springholm, where she lived.
Police said they were doing everything they could to find the missing woman but that it was possible she "may have come to harm".
Detective Chief Inspector Stephen McGrath said: "Kelsey's family are understandably extremely worried about her and they are being supported by specialist officers at this difficult time. We have a dedicated team of officers who are working around the clock to find her and get answers for them."
He added: "While we are keeping an open mind, and continue to hope Kelsey will be found safe and well, we have to consider the possibility that she may have to come to harm."
Officers have been carrying out door-to-door inquiries and requesting doorbell camera footage from neighbours. Dogs, a helicopter and specialist officers have been involved in the search. On Tuesday, a yellow police tent was seen in the entrance to a field yards from her home, and officers in white forensic suits were spotted in the area.
Local area commander Emma Dodds said: "Our priority remains tracing Kelsey and getting answers for her family about her whereabouts. We have a dedicated team, including specialist officers and national resources, following all lines of inquiry."
She added: "I understand this will be concerning for the local community, but please be assured we are doing all we can to find Kelsey. We will remain in the area while our investigation continues."
Kelsey is described as 5ft 4in tall, of slight build with dyed blonde/pink hair. When she was last seen she was wearing a brown jacket and brown boots and was carrying a chequered bag.
Police have appealed for anyone with information to contact them on 101.