You can substitute brown and green lentils, puy lentils, and black lentils for each other in recipes. Note that puy lentils and black lentils will require more time to fully cook than green and brown lentils.  While you can substitute red and yellow lentils for each other, they will not be a good swap with any of the other lentils. Red and yellow lentils break down and lose all of their texture when they are cooked having a very different final result.