Using aftermarket parts instead of genuine?

The part I need for my car can be replaced by yourmechanic with an aftermarket part. It was suggested that I call the dealership to ask them, which I did. I called a few local dealerships and they all quoted a price higher than the aftermarket part, and said it wasn't in stock and would have to be special ordered.

My question is, what is the risk of going with an aftermarket part as opposed to a genuine dealership part?

– Using aftermarket parts instead of genuine?