15 Digit Id is case-sensitive whereas 18 Digit Id is case-insensitive.
Many legacy applications doesn’t support case sensitive strings, so in that case we can make use of 18 digit Id which is case in-sensitive.
15 digit or 18 digit depends upon your requirement and dependent application.
API always makes use of 18 digit Id.
URL in Salesforce makes use of 15 digit Id.
Cheers!!!