If your dog has suddenly lost weight, you should see your veterinarian as soon as possible. For more gradual weight loss, it is okay to schedule a non-urgent appointment (within the week), assuming there are no other concerning symptoms.
Many underlying causes of weight loss are treatable, but your veterinarian will likely need to do some diagnostic testing to determine the cause. Blood and urine testing can be used to rule out causes like diabetes, kidney disease, liver disease.
A physical exam can rule out things like dental disease and palpable tumors, among other things. Diagnostics like abdominal ultrasound and endoscopy may be necessary to diagnose conditions like inflammatory bowel disease.