What is the difference between 狗 and 犬?
Both of them refer to the same thing, "dog". “狗” is used much more in oral speaking, and “犬” is a formal word that you would see in books. 

For words expressed in a classical (formal) way, you won't see "狗" but "犬". 


  An idiom: 一人得道，鸡犬升天 


When a man becomes an Immortal(God), even his pets like chickens and dogs go to heaven. An analogy that when someone becomes powerful, his associates would somehow become powerful too. We use it in a critical and negative way.


  犬子(literally: dog's son) 


It's a word you will use to refer to your son in a humble way. In a few cases, you will hear this word nowadays. You would say "犬子今年20岁" (my son is 20 years old this year), to show your respect to the listener. (Of course, this expression is old-fashioned.)


  鹰犬 (literally: hawk and dog)


When you hunt in the field, you would take advantage of a hawk (falcon) or a dog (hound) to chase the game for you, so this word is an analogy to say "hired thugs", somone that implements your order [to commit crimes]. We use it in a negative way too.


  犬只 (=dog).


Usually, you will see it in the newspaper or the bulletins and  announcements from the government. 


  小犬座 (Canis Minor, a small constellation) Here we don't use 小狗座


狗 is a vulgar (informal) word (in Chinese culture, a dog is not a good thing), so you will see it more in ordinary life, in oral speaking.


  狗腿子 (literally: dog's feet). With the same meaning as “鹰犬".
  狗崽子 (literally: a puppy). A curse word to refer to someone that you hate.
  you would ask your neighbour:"how old is your dog?" "你的狗多大了？" here, you wouldn't say "犬".


Note: There are few idioms with "狗" instead of "犬". For example, “狗尾续貂", but this word came from a popular oral proverb in its times, so this doesn't violate the viewpoint that “犬" is used formally.

When would you use "狗" or "犬"? Well, these words are fixed, so you have to memorize them. It's good to enlarge your vocabulary to avoid misuse. In most cases, you would use "狗".