Considering your app is at https://example.herokuapp.com/, and assuming you own the domain www.example.com as stated, follow the following steps to have your app running on your custom domain:
Using the Heroku CLI
- Add a custom domain with a subdomain
$ heroku domains:add www.example.com
- Add a custom root domain
$ heroku domains:add example.com
On namecheap
After signing into your account
- Select Domain List from the left side menu and click the Manage button next to your domain:

- Navigate to the Advanced DNS tab and click the Add New Record button in the Host Records section:

- To use
www.example.com and example.com, the following host records should be created:
URL Redirect Record for @ to forward to http://www.example.com (http://www.yourdomain.tld in the picture)
CNAME Record for www mapped to your Heroku Domain www.example.com.herokudns.com. (www.yourdomain.tld.herokudns.com. in the picture)

- (Optional) To use any other subdomain, like
app.example.com and example.com, you should create the following records:
URL Redirect Record for @ to forward to http://app.example.com (http://app.yourdomain.tld in the picture)
CNAME Record for app mapped to your Heroku Domain app.example.com.herokudns.com. (app.yourdomain.tld.herokudns.com. in the picture)

That's it! Now your app should be running at www.example.com.
For more information on the namecheap side you can check this link.