I've just replaced my PC case, and it has no room for my old DVD drive. I understand it's possible to use an enclosure to continue using the drive as a peripheral, but I'm not sure how that works, and haven't been able to figure out the right Google keywords to find a guide online. Any help would be greatly appreciated.
In the rare case that i need a optical drive and i leave my USB one at work in my laptop bag. I power down my computer and hook one up and just let it hang out the side of my case till i dont need it anymore.
But for what your going to pay to try and make an internal optical drive and external one you can save yourself a lot of trouble and just buy a USB one.
You need an enclosure designed for a desktop hard drive or similar device, but VERY likely in a size for the older 5¼" drives, since that is the common width of an optical drive. Unlike many such enclosures, though, it does need to have an OPEN front, or an alternate front face panel, to allow for the disk tray to slide out and in. It MUST come with its own power supply module ("wall wart") since the enclosure cannot get enough power for the drive from any common connection cable to the host computer. NOTE I'm assuming you have an older "standard" optical drive that fit into a common 5¼" opening on the case front. There are lots of enclosures for "slim" optical drives only 12.7mm high originally installed for laptops which I assume is NOT what you have.
For data transfer, you may have several options, and many enclosures come with more than one. Almost all will have USB of some sort, but if at all possible and IF your computer has a USB3 port available, get an enclosure with the USB3 variant, not USB2. That will give the full data transfer speeds your drive can do, rather than limit it. USB3 labels can be confusing now, but USB 3, USB 3.1, and USB 3.2 Gen1 are all the same and use the same connecting cables; USB 3.2 Gen2 is faster than you need, but will work just fine. Cable connectors need a little attention. The new USB 3 version of the original Type A connector is still suitable if you have those on both your computer's socket and the enclosure's input socket. At the enclosure, though, you may find it is the USB3 Type B, which is a little smaller and shaped differently - the main difference is that it does not carry any power to the enclosure since it has its own power "brick". Alternatively you may find the newer Type C connector and sockets, which is much smaller with a semi-rectangular shroud with rounded ends, and a small tongue inside carrying the contacts. These are recommended for USB 3.2, especially for Gen2 and faster versions, but not required for the Gen1 version.
Those are the exterior connection details. INSIDE the enclosure you need it to have sockets for the type of device you are mounting - that is, either the old IDE type, or the newer SATA type. So check which your old drive is, and choose accordingly.
I searched for "optical drive enclosure". Here is an example of an enclosure of that type for standard 5¼" optical drive, but only for a SATA drive unit - not older IDE.
It uses the USB 3.2 Gen1 interface with a USB3 Type B input, and suitable cable supplied. I has its own power supply module, but NOTE the user comments - that unit has a non-USA plug, and should come with an adapter to plug into US outlets. This one appears to have a front cover plate, but others are sold with no cover plate.
Here's another with front cover, USB3 cable, and power brick. It is shown with the drive "on edge"; not clear but I assume you could turn it on its side.