Disc drive works sometimes

It’s pretty simple but I would put in a disc and sometimes it wouldn’t eject but it makes the noise as if there were a disc in it but nothing comes out so I would hard reset it and unplug and plug it back in and it would work a little bit then just stop working. Is there any way I can actually fix forever.