Yes, they authorities could use the narcotics as evidence to prosecute. If the police are lawfully in the home--such as being allowed in by the homeowner or a resident to investigate another crime; or responding to an emergency call--if they see narcotics while there, it is as proper for them to take action (e.g. arrest; prosecute) as it would be if the narcotics were seen in a public area, like on a street. As long as the police could be legally where they are, they may make  use of evidence they find.