Those CV is fubar'ed. At this point, I would buy new CV and not worry about a rebuild, not worth the hassle for the price.
Hard to tell but your flanges look like the teeth are okay. If you put the Flange on the CV axle, is there play when you move it left and right? If not much play you can likely just re-use the flanges not buy new.
I would get new inner and outer bearings, and re-pack. Get new C-clip thing and makes sure it's the right thickness, it comes in different dimension options. I would buy a few extra clips in case.
Check the condition of the Knuckle bearing, check condition of Knuckle.
You need new locking washer, and 54mm nuts for sure. I would buy extra lock washers as you may new more in future, this is the thing you have to hammer back and forward to lock with the 54mm nuts. New flange gasket. I bought new nuts and washers and cone washers as they're not too expensive. I also got a new cap, they're not too expensive, if you keep prying the cap open and knocking it back in, it gets worn and loose.
When I replaced the CV axle, I also replaced the oil seal at the differential side. The left and right side, have different part numbers, I use Partsouq.com to check the part # needed for my VIN. The oil seal was a pain in the butt to get out and put in. I used a prybar to get mine out, and minding not to scratch the inside of the diff hole. I used the old seal as a hammer cover, I put the old seal over the new seal, and used a hammer over the old seal to hammer the new seal in, took a long time. You don't want to hammer the new seal directly, you will screw it up. If you're unsure about the seal step, and your seals look fine, just dont touch it!
When you get the new CV axle, be careful when setting them down, as there is a very delicate thin sheet metal around the ring of the CV (outer end). Try to also not damage the rubber gasket material on the outer end. Lay it on soft towel and be careful when inserting it in. You want to make sure there is a clean seal with the knuckle when you slide it in. The new CV axle is very stiff it's hard to move and work with.
When you insert the new CV axle in, there is a C-clip on the inner - end. Make sure that Clip is facing "up" on the groove, you'll use lube so it'll stick to that spot and not move around. If you have the C-clip hanging down on the bottom (6-o'clock) it will be very hard to shove it in. Note you will not shove the CV completely FLUSH into the diff hole, it'll still have a few mm of gap space that's normal, I thought I couldn't get mine shoved in all the way in but in reality it's already locked in.
When you put the new bearing in, replace the races, the new bearings come with the new races together (do both inner and outer races). You need a brass or soft material drift, and a hammer. Lightly tap the old race out, and when putting in the new race, you can use the old race as a tool on top of the old race to hammer it in evenly. You need to cut a small sliver with a dremel on the old race, so it can compress into smaller radius as it goes in and you can take it out. Make sure the new races, are all the way in! Or else you will have alignment problems on the bearing or your caliper may not seat properly.
When you put the bearings in, make sure you properly pack them with lots of lube. Spend a lot of time on this and make sure it's well lubed. Inside the cavity of the HUB you need to make sure it's got LUBE all inside it, don't skimp on this. Poor lube volume will damage bearings. It's a dirty job so get lots of towels and gloves.
The bearing pre-load step is very important (you need to torque the nut to tighten the bearings, then loosen the nut, then torque it very very lightly, then put the lock washer, and outer nut and torque the outer nut, then lock the washer to the nuts). If you don't do the pre-load right you can have a wobbly wheel and loose bearing, which can damage the bearing. Or if it's too tight you can have problems with the bearing getting damaged. Makes sure you do this correct per manual, there is a lot of guides on this on ih8mud.