I find it can be easy to wrap the string with the separators so that you know that a specific search term will be found wherever it is in the string. If you are sure that the format shown in your example will always be adhered to (number comma space number...) then use this:
childId = _context.tblName.Where(x => $", {x.parent_id},".Contains(", 24,")).Select(x => x.id).ToList();
If there may be instances where a space is not included then also remove spaces first.
childId = _context.tblName.Where(x => $",{x.parent_id.Replace(" ", "")},".Contains(",24,")).Select(x => x.id).ToList();
You could reduce the data returned doing your initial search first and then apply this filter:
childId = _context.tblName.Where(x => x.parent_id.Contains("24")).Where(x => $", {x.parent_id},".Contains(", 24,")).Select(x => x.id).ToList();
EDIT:
If you are really super concerned about performance and only returning the rows from the table you can actually specify the SQL yourself.
childId = _context.tblName
.SqlQuery("SELECT * FROM tblName WHERE ', ' + parent_id + ',' LIKE '%, 24,%'")
.ToList<recordType>().Select(x => x.id).ToList();
This can be improved further by only getting the ids from the table rather than the full row. And you should of course parameterise!
childId = _context.Database
.SqlQuery<string>("SELECT id FROM tblName WHERE ', ' + parent_id + ',' LIKE '%, ' + @search + ',%'", new SqlParameter("@search", 24))
.ToList();
There is a tutorial on doing this sort of thing here