Solitude: A voluntary disconnect. Pleasant. You can return to socializing whenever you want.
Loneliness: Being alone against your choice, seemingly unable to change it, even when you are in contact with people.
Donald Hall wrote beautifully about this: https://www.newyorker.com/culture/culture-desk/double-solitu...
I'm almost never lonely when I'm alone, I'm too involved in whatever I'm doing. Even if I'm bored, I'm generally not lonely. I get more lonely when I'm in a group of people I don't really know well than I ever do when I'm alone in my own house. Mostly because I wish I knew them better than I do and wouldn't feel so left out.