Of course it’s ok,
who needs to burn bridges?
And can be a pretty mature thing to do, depending on the situation of course. There’s different levels of “friendship” though. There’s the kind of ‘friend’ you hang with every weekend, and the kind of friend you remember to send a card to on their birthday. Be realistic. Obviously you can’t end a relationship on Monday and expect to be comfortable being ‘friends’ on Tuesday.
And BOTH people have to be on the same page emotionally.