If you want to display the url as text on the webpage, this should be fine. If you are trying to use the string AS a url then don't use htmlspecialchars().
Could you elaborate? What do you mean by "process"? And how is this going to affect security?
First of all thank you for your reply,
I want to display url in 2 different location for different purposes.
First location is the url list. As i think we solved that problem with htmlspecialchars(base64_decode($urlDB)) or htmlentities(base64_decode($urlDB))