The Microsoft documentation "MSSQLSERVER_8632" says
This issue occurs because SQL Server limits the number of identifiers and constants that can be contained in a single expression of a query. This limit is 65,535.
I think the issue in your query is the IN statement since you said there are many values listed in the IN statement. I would suggest to put those values into the TABLE variable and then use the SELECT statement in the IN statement:
DECLARE @ProjectName_TypeIDs TABLE (
ProjectName_TypeID varchar(21)
);
INSERT INTO @ProjectName_TypeIDs (ProjectName_TypeID) VALUES
('01_006_1|1'), ('01_007_1|1'), ('01_007_1|3'), ('01_007_1|15')
select P.ProjectName, T.CaseUID, T.CaseID, T.TypeID, T.ProjectID
from [CaseMaster] T
join [ProjectsMaster] P
on T.ProjectID = P.ProjectID
where CAST(P.ProjectName as varchar(10)) + '|' + CAST(T.TypeID as varchar(10)) IN (SELECT ProjectName_TypeID FROM @ProjectName_TypeIDs)
order by P.ProjectName