Bismihi ta'ala
If it is 'dirt', and it is accessible, and would prevent water from getting to your out layer of skin, then it is wajib to remove, for the purpose of wudhu and ghusl.
If the dirt is not accessible, as in it is a stain under your nail that you cannot remove, or that the dirt is not an obstacle and will not prevent water from getting to your skin, then you do not have to remove it, and your wudhu/ghusl will be valid.
And Allah knows best.