This is my go-to strategy as well. When I feel irrepressible bits of loneliness or depression, I just make some food and go out and start handing out to the needy.
Or go for a walk and find people that need a hand. People moving, lifting things, carrying things. Small little acts of being useful and helpful for a moment help.
The feeling will creep back in eventually, but at least for that time I was out and about, it's not.