You might have double vertices, so select everything and M to merge by distance. Or you might have flipped normals, so select everything and Control + N to recalculate normals. If you want to visualize which face you have inverted, you can turn on Face Orientation on the overlays:
