Trim to length can affect function (it actually fitting into the chamber), safety (having enough neck to grip the bullet at the bearing surface - this depends on bullet seating depth and location, length of the bullet bearing surface, and neck length), can affect velocity and accuracy. To answer your question, it can be all of the above. To what extent does it affect all of the above, there's no definitive answer.
For your powder load development, you have ladder testing, OCW and a bunch others. There's a lot of science, theories and art involved - everyone has their favorites. None of the below steps even gets into seating depth testing. Always load to safe pressures, understand what pressures signs look like (flattened primers, cratered primers, ejector wipe, extractor marks, etc.)
1. You load 0.2gr increments (min 3 rounds per increment) starting at 10% under book max pressure, shoot the rounds keeping track of velocity (you need a chronograph) and pick the middle of the flattest velocity "node". Conducted at minimum 100yds distance, 1 target per charge weight.
2. You load 0.2gr increments (min 3rds per increment) starting at 10% under book max pressure, shoot the rounds and identify where on each target the rounds are impacting. You select the middle of sequential charge weights where the impacts all land in the same area (if aim at center, some charge weights impact 12 o'clock, some 6 o'clock, some 3 o'clock, some 9 o'clock, but you find 3 or more different charge weight increments in a row that impact the same distance from center at the 8 o'clock, the middle is what you pick for these 8 o'clock shots). Conducted at minimum 100yds distance, 1 target per charge weight.
3. You load 0.2gr increments (1 rounds per increment) starting at 10% under book max pressure, shoot the rounds making sure you track the order in which you shot each charge weight increment then note where the impact is on the target. You select the average charge weight where all the impacts are in a similar area on the target. Preferred 300yd, but the farther the distance the test is conducted the better.
4. You load 0.2gr increments (min 3rds per increment) starting at 10% under book max pressure, shoot the rounds on target tracking their velocity and group sizes. Pick the velocity level that you like that produced the group sizes that you liked and forever load those to that charge weight ideally +/- 0.1gr (preferably +/- 0.0gr). Conducted at minimum 100yds distance. 1 target per charge weight.
There are probably some other ways but those are 4 of the common ones.