I have requirement like if i select a user in the people picker get click the select button it should display the selected user permissions for his accessible subsites, lists and list items and his permissions level.i want to achieve this in sharepoint online using REST API.Any help would be appreciated and thanks in advance.
You can use PowerShell script to list the sites, sub-sites,lists and list items that a special user have access to and their roles.
Here are some articles for your reference.
SharePoint Online All User Access/Permissions Report:
SharePoint Online User Permission Reports: