You cannot lock messages on your iPhone. However, you can restrict it with a password using screen time settings.