But likes from him stay in the posts with a link to a profile that does not exist.
You and Google get a 404 error.
That is bad for seo and also wrong from the code.
The 404 (Not Found) say: The requested resource could not be found but may be available again in the future. Subsequent requests by the client are permissible.
The 410 (Gone) say: Indicates that the resource requested is no longer available and will not be available again. This should be used when a resource has been intentionally removed and the resource should be purged.
I should prefer that the profile retained when delete, as well as all other data from the user.
But if that is not possible, a 410 code should be sent and not a 404.