sharepoint online – Grant a user permission on a document using Share or using the Advance permission settings

We have a document library inside a communication online site, and we have 2 approaches to share a file with a user who do not have access to the site:-

  1. Select the Document >> Using the Share link:-
    enter image description here

  2. Select the Document >> click on “Manage Access” >> click on “Advance” >> stop the permission inheritance >> grant the user access to the file:-
    enter image description here

in both cases the user will have access to the file, but is there any differences between the above 2 approaches? or they will satisfy the same need?