When writing html in the code, if you use
<a href="<?php echo get_permalink(123); ?>"></a>
The url outputted is
if you deactive pretty permalinks or, if you active pretty permalinks it change automatically according to your permalink structure.
You never have to hardcoding url in Worpress when writing html in plugin / template files.
If you intend when you have to add a link in the posts content, using the link feature from worpress editor, and "Or link to existing content" option (see image below)
The link that is putted in the html, yes, is hardcoded, but using the current rewrite structure. If you change this structure in the future the link stay the same in the html, but Wordpress is clever enough and your link still works! (I'm sure it works, but I'm not sure how: if I'm not wrong a 301 redirect will be maden).
However if after changing url structure you hate having in the post content urls with old structure (even if they works), you can create a shortcode, like
that outputs the current permalink for the post.
Make this shortcode works is easy, however, someone has already do the work... see here.