How do you let someone you love go knowing it's for the best? Because things won't work out?

I've loved my ex for a long time even after we broke up and I mean really deeply. But I had to let her go because she belonged to someone else. Then this year, very recently, she and her s/o break up. And we start talking a few months after this happens. And hanging out. Then it hits me, it doesn't feel the same with this girl anymore. I still love her, probably always will, but I can't picture us being together ever again. We could be friends, as we still get along, but I guess it would always hurt a little. And I'd rather not. It makes me sad because she's what I've wanted for so long and now I've to let her go again. But I do want her to be happy. Any tips for a situation like this?