When facing Mahito Kento who is a 1st grade professional sorcerer tells Yuji he can't hurt Mahito, but Yuji who is a first year student can. Why is this so? Is it because Yuji has Sukuna inside, or is it because he has something special that makes him able among other things retain Sukuna inside and hurt a close to impossible to hurt cursed spirit?
Aditya Sahu is right: this is explained by Mahito himself in Episode 10 Idle Transfiguration (Japanese: 無為転変; Transcription: "Mui Tenpen") and Episode 12 To You, Someday (Japanese: いつかの君へ; Transcription: "Itsuka no Kimi e").
In episode 10, when Mahito is fighting Nanami, he explains that the soul exists before the body, and that the shape of the body is determined by the shape of the soul. Thus, after his body is damaged by Nanami's attack, he is able to restore it just by strongly maintaining the shape of his soul, rather than using cursed energy to heal. Later, Mahito goes on to explain that while jujutsu sorcerers protect their bodies with cursed energy, they do not protect their souls, because at minimum one needs to be aware of one's own soul in order to protect it with cursed energy. Thus, jujutsu sorcerers are vulnerable to Mahito's idle transfiguration attack.
In episode 12, when Yuuji lands a solid punch on Mahito's laughing face, causing the latter to bleed from his nose, Mahito is initially shocked that Yuuji managed to strike the shape of Mahito's soul. Then, he deduces that this is because Yuuji is acting as a vessel for Ryomen Sukuna—he is constantly housing in his body a soul other than his own—so he is strongly aware of the outline of his own soul.
It is clear from the context of the information given in these episodes that a jujutsu sorcerer will be able to strike and damage the shape of Mahito's soul if and only if they are aware of the shape of their own soul. This is why Yuuji is able to deal damage to Mahito, whereas Nanami is unable to do.