In Section/Chapter 2, George and Lennie are introduced to those that work on the ranch. Toward the end of this section, Lennie decides that the place is too "mean" and he tries to convince George that they should leave. George agrees that he doesn't like it there but tells Lennie they should wait and try to make some money. They both know that, because of Lennie, it is difficult for them to fit in. By not fitting in, Lennie must feel a sense of loneliness. The only reason he doesn't feel completely alone, even in the company of others, is because he has George with him.
The section ends with Candy's ancient dog laboring over to the door. The dog, being old and obsolete, also doesn't fit in. The dog is somewhat of a parallel to Lennie. The only difference is that Lennie can still perform a function (physical work) while the dog has no useful purpose other than companionship for Candy. After everyone has left for dinner, the dog is left alone:
After a moment the ancient dog walked lamely in through the open door. He gazed about with mild, half-blind eyes. He sniffed, and then lay down and put his head between his paws.
In the next chapter, Candy, like his dog, is also getting old and feels like he might be obsolete and lonely as well. Foreseeing the day when his dog will die and when the ranch might have no more use for him, Candy will ask George and Lennie if he can join them when they leave to start their own farm. Both Candy and Lennie (and George, although he really doesn't voice it much) fear being alone.