Do you also see the black line in the camera’s LCD display as well?
If so then I suspect that a row of sensors or a connection to a row of sensors has failed in the camera’s image sensor. It could also be a problem on the motherboard but as a DIY repairer you can only verify where it is by replacing one or the other to see where the problem is, as schematics and service manuals are difficult to find online.
Unfortunately ifixit does not have a repair guide for replacing the image sensor. It only has the repair guides shown in this link Nikon D5100 Repair which you may be able to use in conjunction with the Nikon D5100 Teardown guide which may be of some help in replacing the part if you decide to do this.
Here’s a link to just one supplier of the part. It is only shown to give an idea of the cost of the part. There are other suppliers that may suit you better. Just search online for Nikon D5100 image sensor part to get results for suppliers of the part