Police described the deaths of the men, aged 19 and 23, in Annan as "sudden and unexpected".
Their bodies were found a short time apart on Thursday.
Police Scotland said they were at the early stages of their investigation and appealed for anyone with information about the men to come forward.
Det Insp Scott Young said: "Sadly, I can confirm that two young men have died in Annan.
"For the deaths of these young people to occur in similar circumstances, in a short period of time and in a small geographical area, is unusual.
"We are keeping an open mind at the moment but one of the lines of inquiry is that the deaths may be drugs-related, so we take the opportunity to reiterate that there is no safe way to take drugs."
Two men have been found dead at separate addresses in a Dumfries in Galloway town following what may have been drugs-related incidents.