This can be done through powershell:
$WebApp = SPWebApplication | where {$_.Name -match "OldWebAppName"}
$WebApp.Name ="NewWebAppName"
$WebApp.Update()
# This bit is just to verify it updated correctly
Get-SPWebApplication | where {$_.Name -match "NewWebAppName"}
This script will change only the name of the web application , however to change the url of the web application we need to go with Alternate Access Mappings and IIS Bindings .
To Rename SharePoint 2013 web application URL, lets update the AAM entries first. Go to: Central Administration >> System Settings >> Configure alternate access mappings under Farm Management. Pick your web application and give a new URL to it.

Update HOST Name in IIS Bindings to rename SharePoint Web application URL:
Next step is to update IIS bindings. Go to IIS (Start > Run > InetMgr), Select your target web application, Click on "Bindings" on right pane.
