Chosen Solution

I replaced the housing for iPhone 8 but rear camera and flash are not working anymore. I already tried to replace the camera, but it didn’t help.

If you had to replace the housing too I’d guess the iPhone was smashed for good. Bad hits can cause shorts to components supplying power and data to the related parts, as probably in this case. Try to plug rear camera alone without the front camera connected, to rule out another part induced failure. If that doesn’t dispose of the issue, there’s only board left and you would have to find a Pro in microsoldering to take care of repair.